-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy patherrors.js
More file actions
94 lines (83 loc) · 2.9 KB
/
errors.js
File metadata and controls
94 lines (83 loc) · 2.9 KB
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
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
/*
* Errors thrown by the FramingSocket
* This is in addition to the standard JS Errors (some more useful than others):
*
* EvalError
* RangeError
* ReferenceError
* SyntaxError
* TypeError
* URIError
*/
module.exports = function (util) {
var errors = {};
errors.RecoverableError = function(message) {
Error.call(this);
this.name = 'RecoverableError';
this.message = message;
if (Error.captureStackTrace) {
Error.captureStackTrace(this, errors.RecoverableError);
}
};
util.inherits(errors.RecoverableError, Error);
errors.NonRecoverableError = function(message) {
Error.call(this);
this.name = 'NonRecoverableError';
this.message = message;
if (Error.captureStackTrace) {
Error.captureStackTrace(this, errors.NonRecoverableError);
}
};
util.inherits(errors.NonRecoverableError, Error);
/*
* ---------------------------------------------------------------------
* The errors below must either extend Recoverable or Nonrecoverable
* ---------------------------------------------------------------------
*/
errors.HostUnavailableError = function(message) {
Error.call(this);
this.name = 'HostUnavailableError';
this.message = message;
if (Error.captureStackTrace) {
Error.captureStackTrace(this, errors.HostUnavailableError);
}
};
util.inherits(errors.HostUnavailableError, errors.RecoverableError);
errors.AlreadyConnectedError = function(message) {
Error.call(this);
this.name = 'AlreadyConnectedError';
this.message = message;
if (Error.captureStackTrace) {
Error.captureStackTrace(this, errors.AlreadyConnectedError);
}
};
util.inherits(errors.AlreadyConnectedError, errors.RecoverableError);
errors.NotConnectedError = function(message) {
Error.call(this);
this.name = 'NotConnectedError';
this.message = message;
if (Error.captureStackTrace) {
Error.captureStackTrace(this, errors.NotConnectedError);
}
};
util.inherits(errors.NotConnectedError, errors.RecoverableError);
errors.DuplicateDataError = function(message) {
Error.call(this);
this.name = 'DuplicateDataError';
this.message = message;
if (Error.captureStackTrace) {
Error.captureStackTrace(this, errors.DuplicateDataError);
}
};
util.inherits(errors.DuplicateDataError, errors.RecoverableError);
errors.BufferOverflowError = function(message) {
Error.call(this);
this.name = 'BufferOverflowError';
this.message = message;
if (Error.captureStackTrace) {
Error.captureStackTrace(this, errors.BufferOverflowError);
}
};
util.inherits(errors.BufferOverflowError, errors.RecoverableError);
return errors;
};