diff options
| author | Emīls Piņķis <emils@mullvad.net> | 2019-08-09 16:29:28 +0100 |
|---|---|---|
| committer | Emīls Piņķis <emils@mullvad.net> | 2019-08-11 22:09:11 +0100 |
| commit | 05c8b7239dc689583f224a472cbc3213703a8cbf (patch) | |
| tree | 147d30c0f2b9a74fbcc7c970b03dd9bdaa59be14 /gui/src/renderer | |
| parent | ad1bf2df6143031877ab6f02edf9d9b65836d833 (diff) | |
| download | mullvadvpn-05c8b7239dc689583f224a472cbc3213703a8cbf.tar.xz mullvadvpn-05c8b7239dc689583f224a472cbc3213703a8cbf.zip | |
Parse tunnel parameter block reason in GUI
Diffstat (limited to 'gui/src/renderer')
| -rw-r--r-- | gui/src/renderer/components/NotificationArea.tsx | 32 |
1 files changed, 26 insertions, 6 deletions
diff --git a/gui/src/renderer/components/NotificationArea.tsx b/gui/src/renderer/components/NotificationArea.tsx index fcd0872c2e..78cc013f4d 100644 --- a/gui/src/renderer/components/NotificationArea.tsx +++ b/gui/src/renderer/components/NotificationArea.tsx @@ -14,7 +14,7 @@ import { NotificationTitle, } from './NotificationBanner'; -import { BlockReason, TunnelState } from '../../shared/daemon-rpc-types'; +import { BlockReason, TunnelParameterError, TunnelState } from '../../shared/daemon-rpc-types'; import AccountExpiry from '../lib/account-expiry'; import { parseAuthFailure } from '../lib/auth-failure'; import { IVersionReduxState } from '../redux/version/reducers'; @@ -40,6 +40,29 @@ type State = NotificationAreaPresentation & { visible: boolean; }; +function getTunnelParameterMessage(err: TunnelParameterError): string { + switch (err) { + /// TODO: once bridge constraints can be set, add a more descriptive error message + case 'no_matching_bridge_relay': + case 'no_matching_relay': + return messages.pgettext( + 'in-app-notifications', + 'No relay server matches the current settings. You can try changing the location or the relay settings.', + ); + case 'no_wireguard_key': + return messages.pgettext( + 'in-app-notifications', + 'WireGuard key not set. You can generate one manually in the advanced settings.', + ); + break; + case 'custom_tunnel_host_resultion_error': + return messages.pgettext( + 'in-app-notifications', + 'Failed to resolve host of custom tunnel. Consider changing the settings', + ); + } +} + function getBlockReasonMessage(blockReason: BlockReason): string { switch (blockReason.reason) { case 'auth_failed': @@ -70,11 +93,8 @@ function getBlockReasonMessage(blockReason: BlockReason): string { return messages.pgettext('in-app-notifications', 'Failed to set system DNS server'); case 'start_tunnel_error': return messages.pgettext('in-app-notifications', 'Failed to start tunnel connection'); - case 'no_matching_relay': - return messages.pgettext( - 'in-app-notifications', - 'No relay server matches the current settings. You can try changing the location or the relay settings.', - ); + case 'tunnel_parameter_error': + return getTunnelParameterMessage(blockReason.details); case 'is_offline': return messages.pgettext( 'in-app-notifications', |
