-
Notifications
You must be signed in to change notification settings - Fork 11
/
errors.js
92 lines (77 loc) · 3.01 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
"use strict";
var util = require('util');
var extend = require('util-extend');
var StandardError = require('standard-error');
var AbraxasError = module.exports = function (msg,props) {
StandardError.call(this, msg!=null && msg.toString ? msg.toString() : msg, props);
}
util.inherits(AbraxasError, StandardError);
AbraxasError.prototype.withError = function (error) {
extend(this,error);
return this;
}
AbraxasError.trace = function (constructor) {
var error = new AbraxasError();
Error.captureStackTrace(error,constructor);
return error;
}
var Receive = AbraxasError.Receive = function (message) {
AbraxasError.call(this,'While reading packet body: '+message);
}
util.inherits(Receive, AbraxasError);
Receive.prototype.name = 'ReceiveError';
var Server = AbraxasError.Server = function (code,message,err) {
AbraxasError.call(this,message, {code: code});
}
util.inherits(Server, AbraxasError);
Server.prototype.name = 'ServerError';
var NoStreaming = AbraxasError.NoStreaming = function () {
AbraxasError.call(this,'Server does not support option "streaming"');
}
util.inherits(NoStreaming, AbraxasError);
NoStreaming.prototype.name = 'NoStreaming';
var Connect = AbraxasError.Connect = function (msg) {
AbraxasError.call(this,msg);
}
util.inherits(Connect, AbraxasError);
Connect.prototype.name = 'ConnectError';
var Socket = AbraxasError.Socket = function (msg) {
AbraxasError.call(this,msg);
}
util.inherits(Socket, AbraxasError);
Socket.prototype.name = 'SocketError';
var Parser = AbraxasError.Parser = function (msg) {
AbraxasError.call(this,msg);
}
util.inherits(Parser, AbraxasError);
Parser.prototype.name = 'ParserError';
var Emitter = AbraxasError.Emitter = function (msg) {
AbraxasError.call(this,msg);
}
util.inherits(Emitter, AbraxasError);
Emitter.prototype.name = 'EmitterError';
var JobFail = AbraxasError.JobFail = function (name,jobid) {
AbraxasError.call(this,'Job '+jobid+' failed',{function: name, jobid: jobid});
}
util.inherits(JobFail, AbraxasError);
JobFail.prototype.name = 'JobFail';
var JobException = AbraxasError.JobException = function (name,jobid,payload) {
AbraxasError.call(this,payload,{function: name, jobid: jobid});
}
util.inherits(JobException, JobFail);
JobException.prototype.name = 'JobException';
var ConnectTimeoutException = AbraxasError.ConnectTimeout = function () {
AbraxasError.call(this,'Timeout while waiting for connection');
}
util.inherits(ConnectTimeoutException, AbraxasError);
ConnectTimeoutException.prototype.name = 'ConnectTimeout';
var SubmitTimeoutException = AbraxasError.SubmitTimeout = function () {
AbraxasError.call(this,'Timeout while waiting for connection');
}
util.inherits(SubmitTimeoutException, AbraxasError);
SubmitTimeoutException.prototype.name = 'SubmitTimeout';
var ResponseTimeoutException = AbraxasError.ResponseTimeout = function () {
AbraxasError.call(this,'Timeout while waiting for response');
}
util.inherits(ResponseTimeoutException, AbraxasError);
ResponseTimeoutException.prototype.name = 'ResponseTimeout';