repositories
/
e-mobility-charging-stations-simulator.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Type a ws callback
[e-mobility-charging-stations-simulator.git]
/
src
/
charging-station
/
ocpp
/
OCPPError.ts
diff --git
a/src/charging-station/ocpp/OCPPError.ts
b/src/charging-station/ocpp/OCPPError.ts
index b977062a0957d568180ba9225bfb4fa3f49fcc02..cd449b10f8cbfc93838bb9b617c053a6a9108b4b 100644
(file)
--- a/
src/charging-station/ocpp/OCPPError.ts
+++ b/
src/charging-station/ocpp/OCPPError.ts
@@
-1,16
+1,21
@@
+// Partial Copyright Jerome Benoit. 2021. All Rights Reserved.
+
+import { IncomingRequestCommand, RequestCommand } from '../../types/ocpp/Requests';
+
import { ErrorType } from '../../types/ocpp/ErrorType';
import { ErrorType } from '../../types/ocpp/ErrorType';
-import { IncomingRequestCommand } from '../../types/ocpp/Requests';
export default class OCPPError extends Error {
code: ErrorType | IncomingRequestCommand;
export default class OCPPError extends Error {
code: ErrorType | IncomingRequestCommand;
- details?: unknown;
+ command?: RequestCommand | IncomingRequestCommand;
+ details?: Record<string, unknown>;
- constructor(code: ErrorType | IncomingRequestCommand, message: string,
details?: unknown
) {
+ constructor(code: ErrorType | IncomingRequestCommand, message: string,
command?: RequestCommand | IncomingRequestCommand, details?: Record<string, unknown>
) {
super(message);
this.name = new.target.name;
this.code = code ?? ErrorType.GENERIC_ERROR;
this.message = message ?? '';
super(message);
this.name = new.target.name;
this.code = code ?? ErrorType.GENERIC_ERROR;
this.message = message ?? '';
+ this.command = command;
this.details = details ?? {};
Object.setPrototypeOf(this, new.target.prototype);
this.details = details ?? {};
Object.setPrototypeOf(this, new.target.prototype);