-
-
Notifications
You must be signed in to change notification settings - Fork 41
/
Copy patherrors.js
255 lines (225 loc) · 6.6 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
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
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
import { WAMP_ERROR_MSG } from './constants.js';
export class UriError extends Error {
constructor () {
super(WAMP_ERROR_MSG.URI_ERROR);
this.name = 'UriError';
this.code = 1;
}
}
export class NoBrokerError extends Error {
constructor () {
super(WAMP_ERROR_MSG.NO_BROKER);
this.name = 'NoBrokerError';
this.code = 2;
}
}
export class NoCallbackError extends Error {
constructor () {
super(WAMP_ERROR_MSG.NO_CALLBACK_SPEC);
this.name = 'NoCallbackError';
this.code = 3;
}
}
export class InvalidParamError extends Error {
constructor (parameter) {
super(WAMP_ERROR_MSG.INVALID_PARAM);
this.name = 'InvalidParamError';
this.code = 4;
this.parameter = parameter;
}
}
export class NoSerializerAvailableError extends Error {
constructor () {
super(WAMP_ERROR_MSG.NO_SERIALIZER_AVAILABLE);
this.name = 'NoSerializerAvailableError';
this.code = 6;
}
}
export class NonExistUnsubscribeError extends Error {
constructor () {
super(WAMP_ERROR_MSG.NON_EXIST_UNSUBSCRIBE);
this.name = 'NonExistUnsubscribeError';
this.code = 7;
}
}
export class NoDealerError extends Error {
constructor () {
super(WAMP_ERROR_MSG.NO_DEALER);
this.name = 'NoDealerError';
this.code = 12;
}
}
export class RPCAlreadyRegisteredError extends Error {
constructor () {
super(WAMP_ERROR_MSG.RPC_ALREADY_REGISTERED);
this.name = 'RPCAlreadyRegisteredError';
this.code = 15;
}
}
export class NonExistRPCUnregistrationError extends Error {
constructor () {
super(WAMP_ERROR_MSG.NON_EXIST_RPC_UNREG);
this.name = 'NonExistRPCUnregistrationError';
this.code = 17;
}
}
// Not being used at the moment, but left commented here in case we need it
// export class NonExistRPCInvocationError extends Error {
// constructor () {
// super(WAMP_ERROR_MSG.NON_EXIST_RPC_INVOCATION);
// this.name = 'NonExistRPCInvocationError';
// this.code = 19;
// }
// }
export class NonExistRPCReqIdError extends Error {
constructor () {
super(WAMP_ERROR_MSG.NON_EXIST_RPC_REQ_ID);
this.name = 'NonExistRPCReqIdError';
this.code = 20;
}
}
export class NoRealmError extends Error {
constructor () {
super(WAMP_ERROR_MSG.NO_REALM);
this.name = 'NoRealmError';
this.code = 21;
}
}
export class NoWsOrUrlError extends Error {
constructor () {
super(WAMP_ERROR_MSG.NO_WS_OR_URL);
this.name = 'NoWsOrUrlError';
this.code = 22;
}
}
export class NoCRACallbackOrIdError extends Error {
constructor () {
super(WAMP_ERROR_MSG.NO_CRA_CB_OR_ID);
this.name = 'NoCRACallbackOrIdError';
this.code = 23;
this.errorUri = 'wamp.error.cannot_authenticate';
}
}
export class ChallengeExceptionError extends Error {
constructor () {
super(WAMP_ERROR_MSG.CHALLENGE_EXCEPTION);
this.name = 'ChallengeExceptionError';
this.code = 24;
this.errorUri = 'wamp.error.cannot_authenticate';
}
}
export class PPTNotSupportedError extends Error {
constructor () {
super(WAMP_ERROR_MSG.PPT_NOT_SUPPORTED);
this.name = 'PPTNotSupportedError';
this.code = 25;
}
}
export class PPTInvalidSchemeError extends Error {
constructor () {
super(WAMP_ERROR_MSG.PPT_INVALID_SCHEME);
this.name = 'PPTInvalidSchemeError';
this.code = 26;
}
}
export class PPTSerializerInvalidError extends Error {
constructor () {
super(WAMP_ERROR_MSG.PPT_SRLZ_INVALID);
this.name = 'PPTSerializerInvalidError';
this.code = 27;
}
}
export class PPTSerializationError extends Error {
constructor () {
super(WAMP_ERROR_MSG.PPT_SRLZ_ERR);
this.name = 'PPTSerializationError';
this.code = 28;
}
}
export class ProtocolViolationError extends Error {
constructor (errorUri, details) {
super(details || WAMP_ERROR_MSG.PROTOCOL_VIOLATION);
this.name = 'ProtocolViolationError';
this.code = 29;
this.errorUri = errorUri;
}
}
export class AbortError extends Error {
constructor ({ error, details }) {
super(WAMP_ERROR_MSG.WAMP_ABORT);
this.name = 'AbortedError';
this.code = 30;
this.errorUri = error;
this.details = details;
}
}
export class WampError extends Error {
constructor ({ error, details, argsList, argsDict }) {
super(WAMP_ERROR_MSG.WAMP_GENERAL_ERROR);
this.name = 'WampError';
this.code = 31;
this.errorUri = error;
this.details = details;
this.argsList = argsList;
this.argsDict = argsDict;
}
}
export class SubscribeError extends WampError {
constructor ({ error, details, argsList, argsDict }) {
super({ error, details, argsList, argsDict });
this.name = 'SubscribeError';
this.code = 32;
}
}
export class UnsubscribeError extends WampError {
constructor ({ error, details, argsList, argsDict }) {
super({ error, details, argsList, argsDict });
this.name = 'UnsubscribeError';
this.code = 33;
}
}
export class PublishError extends WampError {
constructor ({ error, details, argsList, argsDict }) {
super({ error, details, argsList, argsDict });
this.name = 'PublishError';
this.code = 34;
}
}
export class RegisterError extends WampError {
constructor ({ error, details, argsList, argsDict }) {
super({ error, details, argsList, argsDict });
this.name = 'RegisterError';
this.code = 35;
}
}
export class UnregisterError extends WampError {
constructor ({ error, details, argsList, argsDict }) {
super({ error, details, argsList, argsDict });
this.name = 'UnregisterError';
this.code = 36;
}
}
export class CallError extends WampError {
constructor ({ error, details, argsList, argsDict }) {
super({ error, details, argsList, argsDict });
this.name = 'CallError';
this.code = 37;
}
}
export class WebsocketError extends Error {
constructor (error) {
super(WAMP_ERROR_MSG.WEBSOCKET_ERROR);
this.name = 'WebsocketError';
this.code = 38;
this.error = error;
}
}
export class FeatureNotSupportedError extends Error {
constructor (role, feature) {
super(WAMP_ERROR_MSG.FEATURE_NOT_SUPPORTED);
this.name = 'FeatureNotSupportedError';
this.code = 39;
this.role = role;
this.feature = feature;
}
}