-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathutils.errors.js
53 lines (51 loc) · 1.51 KB
/
utils.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
48
49
50
51
52
53
/*
* Module code goes here. Use 'module.exports' to export things:
* module.exports.thing = 'a thing';
*
* You can import it from another modules like this:
* var mod = require('utils.errors');
* mod.thing == 'a thing'; // true
*/
var translateErrors = function(error)
{
switch(error)
{
case OK:
return "OK";
case ERR_NOT_OWNER:
return "ERR_NOT_OWNER";
case ERR_NO_PATH:
return "ERR_NO_PATH";
case ERR_NAME_EXISTS:
return "ERR_NAME_EXISTS";
case ERR_BUSY:
return "ERR_BUSY";
case ERR_NOT_FOUND:
return "ERR_NOT_FOUND";
case ERR_NOT_ENOUGH_ENERGY:
return "ERR_NOT_ENOUGH_ENERGY";
case ERR_NOT_ENOUGH_RESOURCES:
return "ERR_NOT_ENOUGH_RESOURCES";
case ERR_INVALID_TARGET:
return "ERR_INVALID_TARGET";
case ERR_FULL:
return "ERR_FULL";
case ERR_NOT_IN_RANGE:
return "ERR_NOT_IN_RANGE";
case ERR_INVALID_ARGS:
return "ERR_INVALID_ARGS";
case ERR_TIRED:
return "ERR_TIRED";
case ERR_NO_BODYPART:
return "ERR_NO_BODYPART";
case ERR_NOT_ENOUGH_EXTENSIONS:
return "ERR_NOT_ENOUGH_EXTENSIONS";
case ERR_RCL_NOT_ENOUGH:
return "ERR_RCL_NOT_ENOUGH";
case ERR_GCL_NOT_ENOUGH:
return "ERR_GCL_NOT_ENOUGH";
default:
return "UNKNOWN_ERR";
}
};
module.exports = translateErrors;