forked from mikermcneil/node-deezer
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy patherrors.js
47 lines (35 loc) · 1.14 KB
/
errors.js
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
43
44
45
46
47
/**
* Module dependencies
*/
var util = require('util');
/**
* Module-wide errors
*/
module.exports = {
notCompatible: function (methodName) {
return new Error('\n' +
'This method (`' + methodName + '`) from Deezer\'s ' +
'client-side JavaScript SDK is not compatible with this library ' +
'because it cannot be used on the server by Node.js.' + '\n' +
'For documentation on using this Node.js module, check out:' + '\n' +
'https://github.com/mikermcneil/node-deezer'
);
},
notYetSupported: function (methodName) {
return new Error ('\n' +
'The method (`' + methodName + '`) is ' +
'not yet supported by the Deezer API.');
},
invalidArgument: function (argName, actualValue, expectedTypes) {
return new Error ('\n' +
'Invalid argument (`' + argName + '`) :: \n' +
'Expected one of: ' + util.inspect(expectedTypes) + '\n' +
'But instead got: ' + util.inspect(actualValue) + '\n' +
'whose type is: ' + typeof(actualValue) );
},
unknownResponseFromDeezer: function (response) {
return new Error ('\n' +
'An unexpected response was returned from the Deezer API:' + '\n' +
response );
}
};