diff options
| -rw-r--r-- | gui/packages/desktop/src/renderer/errors.js | 37 |
1 files changed, 18 insertions, 19 deletions
diff --git a/gui/packages/desktop/src/renderer/errors.js b/gui/packages/desktop/src/renderer/errors.js index 9cbf63808a..32ec75b105 100644 --- a/gui/packages/desktop/src/renderer/errors.js +++ b/gui/packages/desktop/src/renderer/errors.js @@ -4,25 +4,24 @@ import type { BlockReason } from './lib/daemon-rpc'; export class BlockedError extends Error { constructor(reason: BlockReason) { - switch (reason) { - case 'enable_ipv6_error': - super('Could not configure IPv6, please enable it on your system or disable it in the app'); - break; - case 'set_security_policy_error': - super('Failed to apply security policy'); - break; - case 'start_tunnel_error': - super('Failed to start tunnel connection'); - break; - case 'no_matching_relay': - super('No relay server matches the current settings'); - break; - case 'no_account_token': - super('No account token configured'); - break; - default: - super(`Unknown error: ${(reason: empty)}`); - } + const message = (function() { + switch (reason) { + case 'enable_ipv6_error': + return 'Could not configure IPv6, please enable it on your system or disable it in the app'; + case 'set_security_policy_error': + return 'Failed to apply security policy'; + case 'start_tunnel_error': + return 'Failed to start tunnel connection'; + case 'no_matching_relay': + return 'No relay server matches the current settings'; + case 'no_account_token': + return 'No account token configured'; + default: + return `Unknown error: ${(reason: empty)}`; + } + })(); + + super(message); } } |
