summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorJanito Vaqueiro Ferreira Filho <janito@mullvad.net>2018-05-21 05:20:00 -0300
committerJanito Vaqueiro Ferreira Filho <janito@mullvad.net>2018-05-22 10:43:42 -0300
commiteff9be8ecb8e5e00c216d1bc1ee04501677dc348 (patch)
tree5144bf3f8820d5d174a1cc23adf79a6277c40a1f
parentde3bb7eb3ec7ce2a9498ca4f07ee84e52a577ad8 (diff)
downloadmullvadvpn-eff9be8ecb8e5e00c216d1bc1ee04501677dc348.tar.xz
mullvadvpn-eff9be8ecb8e5e00c216d1bc1ee04501677dc348.zip
Change missing credentials error message
What it means to the user is that a connection to the daemon could not be established because apparently the daemon isn't running (or isn't running correctly).
-rw-r--r--app/lib/backend.js10
1 files changed, 8 insertions, 2 deletions
diff --git a/app/lib/backend.js b/app/lib/backend.js
index 4df4d801e8..27b4b2c927 100644
--- a/app/lib/backend.js
+++ b/app/lib/backend.js
@@ -11,7 +11,7 @@ import type { ReduxStore } from '../redux/store';
import type { AccountToken, BackendState, RelaySettingsUpdate } from './ipc-facade';
import type { ConnectionState } from '../redux/connection/reducers';
-export type ErrorType = 'NO_CREDIT' | 'NO_INTERNET' | 'INVALID_ACCOUNT' | 'NO_ACCOUNT' | 'COMMUNICATION_FAILURE' | 'UNKNOWN_ERROR' ;
+export type ErrorType = 'NO_CREDIT' | 'NO_INTERNET' | 'NO_DAEMON' | 'INVALID_ACCOUNT' | 'NO_ACCOUNT' | 'COMMUNICATION_FAILURE' | 'UNKNOWN_ERROR' ;
export class BackendError extends Error {
type: ErrorType;
@@ -51,6 +51,8 @@ export class BackendError extends Error {
return 'Invalid account number';
case 'NO_ACCOUNT':
return 'No account was set';
+ case 'NO_DAEMON':
+ return 'Could not connect to the Mullvad daemon';
case 'COMMUNICATION_FAILURE':
return 'api.mullvad.net is blocked, please check your firewall';
case 'UNKNOWN_ERROR': {
@@ -194,6 +196,10 @@ export class Backend {
}
_rpcErrorToBackendError(e) {
+ if (e instanceof BackendError) {
+ return e;
+ }
+
const isJsonRpcError = e.hasOwnProperty('code');
if (isJsonRpcError) {
switch(e.code) {
@@ -525,7 +531,7 @@ export class Backend {
}
return this._authenticationPromise;
} else {
- return Promise.reject(new Error('Missing authentication credentials.'));
+ return Promise.reject(new BackendError('NO_DAEMON'));
}
}