-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy patherror.js
More file actions
42 lines (39 loc) · 758 Bytes
/
error.js
File metadata and controls
42 lines (39 loc) · 758 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
/**
* Created by Dmitry on 03.06.2016
*/
'use strict';
const debug = true;
class ErrorWrapper {
constructor (error, originalError) {
this.error = error;
this.originalError = originalError;
if (process.env.DEBUG || debug) {
console.error(error, originalError);
}
}
getCode() {
return this.error.code;
}
getMessage() {
return this.error.description;
}
}
ErrorWrapper.err = {
internal: {
code: 100,
description: 'Internal module error'
},
network: {
code: 101,
description: 'Network problem'
},
api: {
code: 102,
description: 'Instagram error'
},
wrong_user_credentials: {
code: 103,
description: 'Wrong or empty user credentials'
}
};
module.exports = ErrorWrapper;