Cleanup MikroORM configuration code for performance storage
[e-mobility-charging-stations-simulator.git] / src / charging-station / ocpp / OCPPError.ts
index b977062a0957d568180ba9225bfb4fa3f49fcc02..9c6f825a6526a3f903c4b2a70e230b6fb2de3103 100644 (file)
@@ -1,16 +1,19 @@
+import { IncomingRequestCommand, RequestCommand } from '../../types/ocpp/Requests';
+
 import { ErrorType } from '../../types/ocpp/ErrorType';
-import { IncomingRequestCommand } from '../../types/ocpp/Requests';
 
 export default class OCPPError extends Error {
   code: ErrorType | IncomingRequestCommand;
+  command?: RequestCommand | IncomingRequestCommand;
   details?: unknown;
 
-  constructor(code: ErrorType | IncomingRequestCommand, message: string, details?: unknown) {
+  constructor(code: ErrorType | IncomingRequestCommand, message: string, command?: RequestCommand | IncomingRequestCommand, details?: unknown) {
     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);