diff options
| author | Haishan <[email protected]> | 2019-05-14 00:30:36 +0800 |
|---|---|---|
| committer | Haishan <[email protected]> | 2019-05-14 23:31:11 +0800 |
| commit | 16e61f15333b2724cf754124de926e1597ce5bde (patch) | |
| tree | 684757445710f6a48f2ce898b0f7d6502267542a /src/misc/errors.js | |
| parent | 882b168082ddbcbe7991a71a09944f1a60084fc3 (diff) | |
feat(logs): fetch logs with correct log level
see also #14
Diffstat (limited to 'src/misc/errors.js')
| -rw-r--r-- | src/misc/errors.js | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/src/misc/errors.js b/src/misc/errors.js new file mode 100644 index 0000000..1891aa0 --- /dev/null +++ b/src/misc/errors.js @@ -0,0 +1,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; +} |
