+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.message = command ?? '';
this.details = details ?? {};
Object.setPrototypeOf(this, new.target.prototype);