Skip to content

Commit 3d1e7de

Browse files
committed
Adds initial ErrorCodes file
1 parent 6623b48 commit 3d1e7de

File tree

1 file changed

+21
-0
lines changed

1 file changed

+21
-0
lines changed

lib/ErrorCodes.js

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
exports.QUERY_ERROR = 1;
2+
exports.NOT_FOUND = 2;
3+
exports.NO_SUPPORT = 3;
4+
exports.MISSING_CALLBACK = 4;
5+
exports.PARAM_MISSMATCH = 5;
6+
7+
Object.defineProperty(exports, "generateError", {
8+
value: function (code, message, extra) {
9+
var err = new Error(message);
10+
err.code = code;
11+
12+
if (extra) {
13+
for (var k in extra) {
14+
err[k] = extra[k];
15+
}
16+
}
17+
18+
return err;
19+
},
20+
enumerable : false
21+
});

0 commit comments

Comments
 (0)