-
Notifications
You must be signed in to change notification settings - Fork 32
/
Copy patherrors.js
59 lines (48 loc) · 1.75 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
48
49
50
51
52
53
54
55
56
57
58
const util = require('util');
/****************************************************************************
* UnimplementedEmberType error
***************************************************************************/
function UnimplementedEmberTypeError(tag) {
Error.captureStackTrace(this, this.constructor);
this.name = this.constructor.name;
var identifier = (tag & 0xC0) >> 6;
var value = (tag & 0x1F).toString();
var tagStr = tag.toString();
if(identifier == 0) {
tagStr = "[UNIVERSAL " + value + "]";
} else if(identifier == 1) {
tagStr = "[APPLICATION " + value + "]";
} else if(identifier == 2) {
tagStr = "[CONTEXT " + value + "]";
} else {
tagStr = "[PRIVATE " + value + "]";
}
this.message = "Unimplemented EmBER type " + tagStr;
}
util.inherits(UnimplementedEmberTypeError, Error);
module.exports.UnimplementedEmberTypeError = UnimplementedEmberTypeError;
function ASN1Error(message) {
Error.captureStackTrace(this, this.constructor);
this.name = this.constructor.name;
this.message = message;
}
util.inherits(ASN1Error, Error);
module.exports.ASN1Error = ASN1Error;
function EmberAccessError(message) {
Error.captureStackTrace(this, this.constructor);
this.name = this.constructor.name;
if(this.message !== undefined) {
this.message = message;
} else {
this.message("Parameter access error");
}
}
util.inherits(EmberAccessError, Error);
module.exports.EmberAccessError = EmberAccessError;
function EmberTimeoutError(message) {
Error.captureStackTrace(this, this.constructor);
this.name = this.constructor.name;
this.message = message;
}
util.inherits(EmberTimeoutError, Error);
module.exports.EmberTimeoutError = EmberTimeoutError;