blob: 1891aa097a71262e1b64ec3d8c80a01408bf5f5d (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
|
export const DOES_NOT_SUPPORT_FETCH = 0;
export const errors = {
[DOES_NOT_SUPPORT_FETCH]: {
message: 'Browser not supported!',
detail: 'This browser does not support "fetch", please choose another one.'
},
default: {
message: 'Oops, something went wrong!'
}
};
export function deriveMessageFromError(err) {
const { code } = err;
if (typeof code === 'number') {
return errors[code];
}
return errors.default;
}
|