diff options
| author | Tobias Järvelöv <tobias.jarvelov@mullvad.net> | 2025-04-11 15:53:14 +0200 |
|---|---|---|
| committer | Sebastian Holmin <sebastian.holmin@mullvad.net> | 2025-05-28 13:25:31 +0200 |
| commit | 4bc5d4a856beacc9eeb937114ab2aecb509725b5 (patch) | |
| tree | 9af7d695900fea5ffd259f3f1bd78d931e26fcc3 | |
| parent | 6cec68224a2b21021d0c944a1cba5920b08ad410 (diff) | |
| download | mullvadvpn-4bc5d4a856beacc9eeb937114ab2aecb509725b5.tar.xz mullvadvpn-4bc5d4a856beacc9eeb937114ab2aecb509725b5.zip | |
Refactor upgrade error message function to return string directly
Instead of in an array.
| -rw-r--r-- | desktop/packages/mullvad-vpn/src/renderer/components/views/app-upgrade/components/upgrade-label/components/upgrade-error/hooks/useMessage.ts | 56 |
1 files changed, 27 insertions, 29 deletions
diff --git a/desktop/packages/mullvad-vpn/src/renderer/components/views/app-upgrade/components/upgrade-label/components/upgrade-error/hooks/useMessage.ts b/desktop/packages/mullvad-vpn/src/renderer/components/views/app-upgrade/components/upgrade-label/components/upgrade-error/hooks/useMessage.ts index fbfa1765c1..597edc9db3 100644 --- a/desktop/packages/mullvad-vpn/src/renderer/components/views/app-upgrade/components/upgrade-label/components/upgrade-error/hooks/useMessage.ts +++ b/desktop/packages/mullvad-vpn/src/renderer/components/views/app-upgrade/components/upgrade-label/components/upgrade-error/hooks/useMessage.ts @@ -16,38 +16,36 @@ export const useMessage = () => { switch (error) { case 'DOWNLOAD_FAILED': - return [ - // TRANSLATORS: Label displayed when an error occurred due to the download failing - messages.pgettext( - 'app-upgrade-view', - 'Unable to download update. Check your connection and/or firewall then try again. If this problem persists, please contact support.', - ), - ]; + // TRANSLATORS: Label displayed when an error occurred due to the download failing + return messages.pgettext( + 'app-upgrade-view', + 'Unable to download update. Check your connection and/or firewall then try again. If this problem persists, please contact support.', + ); + case 'INSTALLER_FAILED': + // TRANSLATORS: Label displayed when an error occurred within the installer + return messages.pgettext( + 'app-upgrade-view', + 'Installer encountered an error. Try again. If this problem persists, please contact support.', + ); case 'START_INSTALLER_AUTOMATIC_FAILED': case 'START_INSTALLER_FAILED': - return [ - // TRANSLATORS: Label displayed when an error occurred due to the installer failing to start - // TRANSLATORS: and the suggested resolution is to download the update again. - messages.pgettext( - 'app-upgrade-view', - 'Could not start the update installer, try downloading it again. If this problem persists, please contact support.', - ), - ]; + // TRANSLATORS: Label displayed when an error occurred due to the installer failing to start + // TRANSLATORS: and the suggested resolution is to download the update again. + return messages.pgettext( + 'app-upgrade-view', + 'Could not start the update installer, try downloading it again. If this problem persists, please contact support.', + ); case 'VERIFICATION_FAILED': - return [ - // TRANSLATORS: Label displayed when an error occurred due to the installer failed verification - messages.pgettext( - 'app-upgrade-view', - 'Verification failed. Try again. If this problem persists, please contact support.', - ), - ]; + // TRANSLATORS: Label displayed when an error occurred due to the installer failed verification + return messages.pgettext( + 'app-upgrade-view', + 'Verification failed. Try again. If this problem persists, please contact support.', + ); default: - return [ - // TRANSLATORS: Label displayed when an unknown error occurred - messages.pgettext( - 'app-upgrade-view', - 'An unknown error occurred. Please try again. If this problem persists, please contact support.', - ), - ]; + // TRANSLATORS: Label displayed when an unknown error occurred + return messages.pgettext( + 'app-upgrade-view', + 'An unknown error occurred. Please try again. If this problem persists, please contact support.', + ); } }; |
