nodejs-poolcontroller 8.1.2 → 8.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.eslintrc.json +36 -36
- package/.github/ISSUE_TEMPLATE/1-bug-report.yml +84 -84
- package/.github/ISSUE_TEMPLATE/2-docs.md +12 -12
- package/.github/ISSUE_TEMPLATE/3-proposal.md +28 -28
- package/.github/ISSUE_TEMPLATE/config.yml +8 -8
- package/.github/copilot-instructions.md +63 -0
- package/.github/workflows/ghcr-publish.yml +67 -0
- package/AGENTS.md +597 -0
- package/CONTRIBUTING.md +74 -74
- package/Changelog +292 -257
- package/Dockerfile +62 -19
- package/Gruntfile.js +40 -40
- package/LICENSE +661 -661
- package/README.md +318 -191
- package/anslq25/MessagesMock.ts +221 -221
- package/anslq25/boards/MockBoardFactory.ts +49 -49
- package/anslq25/boards/MockEasyTouchBoard.ts +696 -696
- package/anslq25/boards/MockSystemBoard.ts +216 -216
- package/anslq25/chemistry/MockChlorinator.ts +98 -98
- package/anslq25/pumps/MockPump.ts +83 -83
- package/app.ts +115 -115
- package/config/Config.ts +57 -7
- package/config/VersionCheck.ts +63 -35
- package/controller/Constants.ts +809 -805
- package/controller/Equipment.ts +2688 -2664
- package/controller/Errors.ts +181 -181
- package/controller/Lockouts.ts +549 -549
- package/controller/State.ts +3738 -3690
- package/controller/boards/AquaLinkBoard.ts +1003 -1003
- package/controller/boards/BoardFactory.ts +53 -53
- package/controller/boards/EasyTouchBoard.ts +3202 -3202
- package/controller/boards/IntelliCenterBoard.ts +4393 -3899
- package/controller/boards/IntelliComBoard.ts +69 -69
- package/controller/boards/IntelliTouchBoard.ts +382 -382
- package/controller/boards/NixieBoard.ts +1944 -1929
- package/controller/boards/SunTouchBoard.ts +400 -400
- package/controller/boards/SystemBoard.ts +5268 -5268
- package/controller/comms/Comms.ts +1272 -1214
- package/controller/comms/ScreenLogic.ts +1665 -1665
- package/controller/comms/messages/Messages.ts +1433 -1243
- package/controller/comms/messages/config/ChlorinatorMessage.ts +5 -0
- package/controller/comms/messages/config/CircuitGroupMessage.ts +0 -0
- package/controller/comms/messages/config/CircuitMessage.ts +0 -0
- package/controller/comms/messages/config/ConfigMessage.ts +6 -0
- package/controller/comms/messages/config/CoverMessage.ts +0 -0
- package/controller/comms/messages/config/CustomNameMessage.ts +31 -31
- package/controller/comms/messages/config/EquipmentMessage.ts +216 -210
- package/controller/comms/messages/config/ExternalMessage.ts +96 -10
- package/controller/comms/messages/config/FeatureMessage.ts +0 -0
- package/controller/comms/messages/config/GeneralMessage.ts +0 -0
- package/controller/comms/messages/config/HeaterMessage.ts +0 -0
- package/controller/comms/messages/config/IntellichemMessage.ts +0 -0
- package/controller/comms/messages/config/OptionsMessage.ts +194 -174
- package/controller/comms/messages/config/PumpMessage.ts +0 -0
- package/controller/comms/messages/config/RemoteMessage.ts +0 -0
- package/controller/comms/messages/config/ScheduleMessage.ts +401 -390
- package/controller/comms/messages/config/SecurityMessage.ts +0 -0
- package/controller/comms/messages/config/ValveMessage.ts +0 -0
- package/controller/comms/messages/status/ChlorinatorStateMessage.ts +0 -0
- package/controller/comms/messages/status/EquipmentStateMessage.ts +1158 -822
- package/controller/comms/messages/status/HeaterStateMessage.ts +135 -135
- package/controller/comms/messages/status/IntelliChemStateMessage.ts +448 -448
- package/controller/comms/messages/status/IntelliValveStateMessage.ts +36 -36
- package/controller/comms/messages/status/PumpStateMessage.ts +0 -0
- package/controller/comms/messages/status/RegalModbusStateMessage.ts +411 -0
- package/controller/comms/messages/status/VersionMessage.ts +103 -41
- package/controller/nixie/Nixie.ts +173 -173
- package/controller/nixie/NixieEquipment.ts +104 -104
- package/controller/nixie/bodies/Body.ts +120 -120
- package/controller/nixie/bodies/Filter.ts +135 -135
- package/controller/nixie/chemistry/ChemController.ts +2724 -2724
- package/controller/nixie/chemistry/ChemDoser.ts +806 -806
- package/controller/nixie/chemistry/Chlorinator.ts +367 -367
- package/controller/nixie/circuits/Circuit.ts +478 -478
- package/controller/nixie/heaters/Heater.ts +834 -834
- package/controller/nixie/pumps/Pump.ts +1194 -996
- package/controller/nixie/schedules/Schedule.ts +401 -401
- package/controller/nixie/valves/Valve.ts +170 -170
- package/defaultConfig.json +352 -347
- package/docker-compose.yml +32 -0
- package/logger/DataLogger.ts +448 -448
- package/logger/Logger.ts +448 -436
- package/package.json +58 -60
- package/sendSocket.js +32 -32
- package/tsconfig.json +25 -25
- package/types/express-multer.d.ts +32 -0
- package/web/Server.ts +1937 -1927
- package/web/bindings/aqualinkD.json +559 -559
- package/web/bindings/influxDB.json +1066 -1066
- package/web/bindings/mqtt.json +721 -721
- package/web/bindings/mqttAlt.json +746 -746
- package/web/bindings/rulesManager.json +54 -54
- package/web/bindings/smartThings-Hubitat.json +31 -31
- package/web/bindings/valveRelays.json +20 -20
- package/web/bindings/vera.json +25 -25
- package/web/interfaces/baseInterface.ts +188 -188
- package/web/interfaces/httpInterface.ts +148 -148
- package/web/interfaces/influxInterface.ts +283 -283
- package/web/interfaces/mqttInterface.ts +695 -695
- package/web/interfaces/ruleInterface.ts +101 -87
- package/web/services/config/Config.ts +1063 -1053
- package/web/services/config/ConfigSocket.ts +0 -0
- package/web/services/state/State.ts +0 -0
- package/web/services/state/StateSocket.ts +0 -0
- package/web/services/utilities/Utilities.ts +233 -233
- package/.github/workflows/docker-publish-njsPC-linux.yml +0 -50
package/controller/Errors.ts
CHANGED
|
@@ -1,181 +1,181 @@
|
|
|
1
|
-
/* nodejs-poolController. An application to control pool equipment.
|
|
2
|
-
Copyright (C) 2016, 2017, 2018, 2019, 2020, 2021, 2022.
|
|
3
|
-
Russell Goldin, tagyoureit. russ.goldin@gmail.com
|
|
4
|
-
|
|
5
|
-
This program is free software: you can redistribute it and/or modify
|
|
6
|
-
it under the terms of the GNU Affero General Public License as
|
|
7
|
-
published by the Free Software Foundation, either version 3 of the
|
|
8
|
-
License, or (at your option) any later version.
|
|
9
|
-
|
|
10
|
-
This program is distributed in the hope that it will be useful,
|
|
11
|
-
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
12
|
-
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
13
|
-
GNU Affero General Public License for more details.
|
|
14
|
-
|
|
15
|
-
You should have received a copy of the GNU Affero General Public License
|
|
16
|
-
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
17
|
-
*/
|
|
18
|
-
import extend = require("extend");
|
|
19
|
-
import { Message, Outbound, Inbound } from "./comms/messages/Messages";
|
|
20
|
-
import * as path from "path";
|
|
21
|
-
|
|
22
|
-
// Internal abstract class for all errors.
|
|
23
|
-
class ApiError extends Error {
|
|
24
|
-
constructor(message: string, code?: number, httpCode?: number) {
|
|
25
|
-
super(message);
|
|
26
|
-
this.name = 'ApiError';
|
|
27
|
-
this.code = code || 0;
|
|
28
|
-
this.httpCode = httpCode || 400;
|
|
29
|
-
let pos: any = {};
|
|
30
|
-
if (typeof this.stack !== 'undefined') {
|
|
31
|
-
try {
|
|
32
|
-
// Another weirdo decision by NodeJS to not include the line numbers and source. Only a text based stack trace.
|
|
33
|
-
let lines = this.stack.split('\n');
|
|
34
|
-
for (let i = 0; i < lines.length; i++) {
|
|
35
|
-
let line = lines[i];
|
|
36
|
-
if (line.trimLeft().startsWith('at ')) {
|
|
37
|
-
let lastParen = line.lastIndexOf(')');
|
|
38
|
-
let firstParen = line.indexOf('(');
|
|
39
|
-
if (lastParen >= 0 && firstParen >= 0) {
|
|
40
|
-
let p = line.substring(firstParen + 1, lastParen);
|
|
41
|
-
let m = /(\:\d+\:\d+)(?!.*\1)/g;
|
|
42
|
-
let matches = p.match(m);
|
|
43
|
-
let linecol = '';
|
|
44
|
-
let lastIndex = -1;
|
|
45
|
-
if (matches.length > 0) {
|
|
46
|
-
linecol = matches[matches.length - 1];
|
|
47
|
-
lastIndex = p.lastIndexOf(linecol);
|
|
48
|
-
p = p.substring(0, lastIndex);
|
|
49
|
-
if (linecol.startsWith(':')) linecol = linecol.substring(1);
|
|
50
|
-
let lastcolon = linecol.lastIndexOf(':');
|
|
51
|
-
if (lastcolon !== -1) {
|
|
52
|
-
pos.column = parseInt(linecol.substring(lastcolon + 1), 10);
|
|
53
|
-
pos.line = parseInt(linecol.substring(0, lastcolon), 10);
|
|
54
|
-
}
|
|
55
|
-
}
|
|
56
|
-
let po = path.parse(p);
|
|
57
|
-
pos.dir = po.dir;
|
|
58
|
-
pos.file = po.base;
|
|
59
|
-
}
|
|
60
|
-
break;
|
|
61
|
-
}
|
|
62
|
-
}
|
|
63
|
-
} catch (e) { }
|
|
64
|
-
}
|
|
65
|
-
this.position = pos;
|
|
66
|
-
}
|
|
67
|
-
public code: number = 0;
|
|
68
|
-
public httpCode: number = 500;
|
|
69
|
-
public position: any = {}
|
|
70
|
-
}
|
|
71
|
-
class EquipmentError extends ApiError {
|
|
72
|
-
constructor(message: string, code: number, eqType: string) {
|
|
73
|
-
super(message, 210, 400);
|
|
74
|
-
this.name = 'EquipmentError';
|
|
75
|
-
this.equipmentType = eqType;
|
|
76
|
-
}
|
|
77
|
-
public equipmentType: string;
|
|
78
|
-
}
|
|
79
|
-
export class EquipmentNotFoundError extends EquipmentError {
|
|
80
|
-
constructor(message: string, eqType: string) {
|
|
81
|
-
super(message, 204, eqType);
|
|
82
|
-
this.name = 'EquipmentNotFound';
|
|
83
|
-
}
|
|
84
|
-
}
|
|
85
|
-
export class InvalidEquipmentIdError extends EquipmentError {
|
|
86
|
-
constructor(message: string, id: number, eqType: string) {
|
|
87
|
-
super(message, 250, eqType);
|
|
88
|
-
this.name = 'InvalidEquipmentId';
|
|
89
|
-
}
|
|
90
|
-
public id: number;
|
|
91
|
-
}
|
|
92
|
-
export class InvalidEquipmentDataError extends EquipmentError {
|
|
93
|
-
constructor(message: string, eqType: string, eqData) {
|
|
94
|
-
super(message, 270, eqType);
|
|
95
|
-
this.name = 'InvalidEquipmentData';
|
|
96
|
-
this.eqData = eqData;
|
|
97
|
-
}
|
|
98
|
-
public eqData;
|
|
99
|
-
}
|
|
100
|
-
export class ServiceProcessError extends ApiError {
|
|
101
|
-
constructor(message: string, serviceName: string, process?: string) {
|
|
102
|
-
super(message, 290, 400);
|
|
103
|
-
this.name = 'ServiceProcessError';
|
|
104
|
-
this.service = serviceName;
|
|
105
|
-
this.process = process;
|
|
106
|
-
}
|
|
107
|
-
public process: string;
|
|
108
|
-
public service: string;
|
|
109
|
-
}
|
|
110
|
-
export class ServiceParameterError extends ApiError {
|
|
111
|
-
constructor(message: string, serviceName: string, paramName: string, value) {
|
|
112
|
-
super(message, 280, 400);
|
|
113
|
-
this.name = 'InvalidServiceParameter';
|
|
114
|
-
|
|
115
|
-
this.value = value;
|
|
116
|
-
this.parameter = paramName;
|
|
117
|
-
this.service = serviceName;
|
|
118
|
-
}
|
|
119
|
-
public value;
|
|
120
|
-
public parameter: string;
|
|
121
|
-
public service: string;
|
|
122
|
-
}
|
|
123
|
-
export class InvalidOperationError extends ApiError {
|
|
124
|
-
constructor(message: string, operation: string) {
|
|
125
|
-
super(message, 100, 400);
|
|
126
|
-
this.name = 'InvalidOperation';
|
|
127
|
-
this.operation = operation;
|
|
128
|
-
}
|
|
129
|
-
public operation: string;
|
|
130
|
-
}
|
|
131
|
-
export class EquipmentTimeoutError extends ApiError {
|
|
132
|
-
constructor(message: string, operation: string) {
|
|
133
|
-
super(message, 100, 400);
|
|
134
|
-
this.name = 'TimeoutError';
|
|
135
|
-
this.operation = operation;
|
|
136
|
-
}
|
|
137
|
-
public operation: string;
|
|
138
|
-
}
|
|
139
|
-
export class ParameterOutOfRangeError extends InvalidOperationError {
|
|
140
|
-
constructor(message: string, operation: string, parameter: string, value) {
|
|
141
|
-
super(message, operation);
|
|
142
|
-
this.name = 'ParameterOutOfRange';
|
|
143
|
-
this.operation = operation;
|
|
144
|
-
}
|
|
145
|
-
public value;
|
|
146
|
-
public parameter: string;
|
|
147
|
-
}
|
|
148
|
-
export class BoardProcessError extends ApiError {
|
|
149
|
-
constructor(message: string, process?: string) {
|
|
150
|
-
super(message, 300, 400);
|
|
151
|
-
this.name = 'ProcessingError';
|
|
152
|
-
this.process = process;
|
|
153
|
-
}
|
|
154
|
-
public process: string;
|
|
155
|
-
|
|
156
|
-
}
|
|
157
|
-
|
|
158
|
-
export class MessageError extends ApiError {
|
|
159
|
-
constructor(msg: Message, message: string, code?: number, httpCode?: number) {
|
|
160
|
-
super(message, code, httpCode);
|
|
161
|
-
this.name = 'MessageError';
|
|
162
|
-
this.msg = msg;
|
|
163
|
-
this.code = code || 500;
|
|
164
|
-
}
|
|
165
|
-
public msg: Message;
|
|
166
|
-
}
|
|
167
|
-
export class OutboundMessageError extends MessageError {
|
|
168
|
-
constructor(msg: Outbound, message: string, code?: number, httpCode?: number) {
|
|
169
|
-
super(msg, message, code, httpCode);
|
|
170
|
-
this.name = 'OutboundMessageError';
|
|
171
|
-
this.code = code || 501;
|
|
172
|
-
}
|
|
173
|
-
}
|
|
174
|
-
export class InboundMessageError extends MessageError {
|
|
175
|
-
constructor(msg: Inbound, message: string, code?: number, httpCode?: number) {
|
|
176
|
-
super(msg, message, code, httpCode);
|
|
177
|
-
this.name = 'InboundMessageError';
|
|
178
|
-
this.code = code || 502;
|
|
179
|
-
}
|
|
180
|
-
}
|
|
181
|
-
|
|
1
|
+
/* nodejs-poolController. An application to control pool equipment.
|
|
2
|
+
Copyright (C) 2016, 2017, 2018, 2019, 2020, 2021, 2022.
|
|
3
|
+
Russell Goldin, tagyoureit. russ.goldin@gmail.com
|
|
4
|
+
|
|
5
|
+
This program is free software: you can redistribute it and/or modify
|
|
6
|
+
it under the terms of the GNU Affero General Public License as
|
|
7
|
+
published by the Free Software Foundation, either version 3 of the
|
|
8
|
+
License, or (at your option) any later version.
|
|
9
|
+
|
|
10
|
+
This program is distributed in the hope that it will be useful,
|
|
11
|
+
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
12
|
+
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
13
|
+
GNU Affero General Public License for more details.
|
|
14
|
+
|
|
15
|
+
You should have received a copy of the GNU Affero General Public License
|
|
16
|
+
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
17
|
+
*/
|
|
18
|
+
import extend = require("extend");
|
|
19
|
+
import { Message, Outbound, Inbound } from "./comms/messages/Messages";
|
|
20
|
+
import * as path from "path";
|
|
21
|
+
|
|
22
|
+
// Internal abstract class for all errors.
|
|
23
|
+
class ApiError extends Error {
|
|
24
|
+
constructor(message: string, code?: number, httpCode?: number) {
|
|
25
|
+
super(message);
|
|
26
|
+
this.name = 'ApiError';
|
|
27
|
+
this.code = code || 0;
|
|
28
|
+
this.httpCode = httpCode || 400;
|
|
29
|
+
let pos: any = {};
|
|
30
|
+
if (typeof this.stack !== 'undefined') {
|
|
31
|
+
try {
|
|
32
|
+
// Another weirdo decision by NodeJS to not include the line numbers and source. Only a text based stack trace.
|
|
33
|
+
let lines = this.stack.split('\n');
|
|
34
|
+
for (let i = 0; i < lines.length; i++) {
|
|
35
|
+
let line = lines[i];
|
|
36
|
+
if (line.trimLeft().startsWith('at ')) {
|
|
37
|
+
let lastParen = line.lastIndexOf(')');
|
|
38
|
+
let firstParen = line.indexOf('(');
|
|
39
|
+
if (lastParen >= 0 && firstParen >= 0) {
|
|
40
|
+
let p = line.substring(firstParen + 1, lastParen);
|
|
41
|
+
let m = /(\:\d+\:\d+)(?!.*\1)/g;
|
|
42
|
+
let matches = p.match(m);
|
|
43
|
+
let linecol = '';
|
|
44
|
+
let lastIndex = -1;
|
|
45
|
+
if (matches.length > 0) {
|
|
46
|
+
linecol = matches[matches.length - 1];
|
|
47
|
+
lastIndex = p.lastIndexOf(linecol);
|
|
48
|
+
p = p.substring(0, lastIndex);
|
|
49
|
+
if (linecol.startsWith(':')) linecol = linecol.substring(1);
|
|
50
|
+
let lastcolon = linecol.lastIndexOf(':');
|
|
51
|
+
if (lastcolon !== -1) {
|
|
52
|
+
pos.column = parseInt(linecol.substring(lastcolon + 1), 10);
|
|
53
|
+
pos.line = parseInt(linecol.substring(0, lastcolon), 10);
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
let po = path.parse(p);
|
|
57
|
+
pos.dir = po.dir;
|
|
58
|
+
pos.file = po.base;
|
|
59
|
+
}
|
|
60
|
+
break;
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
} catch (e) { }
|
|
64
|
+
}
|
|
65
|
+
this.position = pos;
|
|
66
|
+
}
|
|
67
|
+
public code: number = 0;
|
|
68
|
+
public httpCode: number = 500;
|
|
69
|
+
public position: any = {}
|
|
70
|
+
}
|
|
71
|
+
class EquipmentError extends ApiError {
|
|
72
|
+
constructor(message: string, code: number, eqType: string) {
|
|
73
|
+
super(message, 210, 400);
|
|
74
|
+
this.name = 'EquipmentError';
|
|
75
|
+
this.equipmentType = eqType;
|
|
76
|
+
}
|
|
77
|
+
public equipmentType: string;
|
|
78
|
+
}
|
|
79
|
+
export class EquipmentNotFoundError extends EquipmentError {
|
|
80
|
+
constructor(message: string, eqType: string) {
|
|
81
|
+
super(message, 204, eqType);
|
|
82
|
+
this.name = 'EquipmentNotFound';
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
export class InvalidEquipmentIdError extends EquipmentError {
|
|
86
|
+
constructor(message: string, id: number, eqType: string) {
|
|
87
|
+
super(message, 250, eqType);
|
|
88
|
+
this.name = 'InvalidEquipmentId';
|
|
89
|
+
}
|
|
90
|
+
public id: number;
|
|
91
|
+
}
|
|
92
|
+
export class InvalidEquipmentDataError extends EquipmentError {
|
|
93
|
+
constructor(message: string, eqType: string, eqData) {
|
|
94
|
+
super(message, 270, eqType);
|
|
95
|
+
this.name = 'InvalidEquipmentData';
|
|
96
|
+
this.eqData = eqData;
|
|
97
|
+
}
|
|
98
|
+
public eqData;
|
|
99
|
+
}
|
|
100
|
+
export class ServiceProcessError extends ApiError {
|
|
101
|
+
constructor(message: string, serviceName: string, process?: string) {
|
|
102
|
+
super(message, 290, 400);
|
|
103
|
+
this.name = 'ServiceProcessError';
|
|
104
|
+
this.service = serviceName;
|
|
105
|
+
this.process = process;
|
|
106
|
+
}
|
|
107
|
+
public process: string;
|
|
108
|
+
public service: string;
|
|
109
|
+
}
|
|
110
|
+
export class ServiceParameterError extends ApiError {
|
|
111
|
+
constructor(message: string, serviceName: string, paramName: string, value) {
|
|
112
|
+
super(message, 280, 400);
|
|
113
|
+
this.name = 'InvalidServiceParameter';
|
|
114
|
+
|
|
115
|
+
this.value = value;
|
|
116
|
+
this.parameter = paramName;
|
|
117
|
+
this.service = serviceName;
|
|
118
|
+
}
|
|
119
|
+
public value;
|
|
120
|
+
public parameter: string;
|
|
121
|
+
public service: string;
|
|
122
|
+
}
|
|
123
|
+
export class InvalidOperationError extends ApiError {
|
|
124
|
+
constructor(message: string, operation: string) {
|
|
125
|
+
super(message, 100, 400);
|
|
126
|
+
this.name = 'InvalidOperation';
|
|
127
|
+
this.operation = operation;
|
|
128
|
+
}
|
|
129
|
+
public operation: string;
|
|
130
|
+
}
|
|
131
|
+
export class EquipmentTimeoutError extends ApiError {
|
|
132
|
+
constructor(message: string, operation: string) {
|
|
133
|
+
super(message, 100, 400);
|
|
134
|
+
this.name = 'TimeoutError';
|
|
135
|
+
this.operation = operation;
|
|
136
|
+
}
|
|
137
|
+
public operation: string;
|
|
138
|
+
}
|
|
139
|
+
export class ParameterOutOfRangeError extends InvalidOperationError {
|
|
140
|
+
constructor(message: string, operation: string, parameter: string, value) {
|
|
141
|
+
super(message, operation);
|
|
142
|
+
this.name = 'ParameterOutOfRange';
|
|
143
|
+
this.operation = operation;
|
|
144
|
+
}
|
|
145
|
+
public value;
|
|
146
|
+
public parameter: string;
|
|
147
|
+
}
|
|
148
|
+
export class BoardProcessError extends ApiError {
|
|
149
|
+
constructor(message: string, process?: string) {
|
|
150
|
+
super(message, 300, 400);
|
|
151
|
+
this.name = 'ProcessingError';
|
|
152
|
+
this.process = process;
|
|
153
|
+
}
|
|
154
|
+
public process: string;
|
|
155
|
+
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
export class MessageError extends ApiError {
|
|
159
|
+
constructor(msg: Message, message: string, code?: number, httpCode?: number) {
|
|
160
|
+
super(message, code, httpCode);
|
|
161
|
+
this.name = 'MessageError';
|
|
162
|
+
this.msg = msg;
|
|
163
|
+
this.code = code || 500;
|
|
164
|
+
}
|
|
165
|
+
public msg: Message;
|
|
166
|
+
}
|
|
167
|
+
export class OutboundMessageError extends MessageError {
|
|
168
|
+
constructor(msg: Outbound, message: string, code?: number, httpCode?: number) {
|
|
169
|
+
super(msg, message, code, httpCode);
|
|
170
|
+
this.name = 'OutboundMessageError';
|
|
171
|
+
this.code = code || 501;
|
|
172
|
+
}
|
|
173
|
+
}
|
|
174
|
+
export class InboundMessageError extends MessageError {
|
|
175
|
+
constructor(msg: Inbound, message: string, code?: number, httpCode?: number) {
|
|
176
|
+
super(msg, message, code, httpCode);
|
|
177
|
+
this.name = 'InboundMessageError';
|
|
178
|
+
this.code = code || 502;
|
|
179
|
+
}
|
|
180
|
+
}
|
|
181
|
+
|