Use camel case everywhere
[e-mobility-charging-stations-simulator.git] / src / charging-station / ocpp / OCPPError.ts
... / ...
CommitLineData
1// Partial Copyright Jerome Benoit. 2021. All Rights Reserved.
2
3import { IncomingRequestCommand, RequestCommand } from '../../types/ocpp/Requests';
4
5import BaseError from '../../exception/BaseError';
6import { ErrorType } from '../../types/ocpp/ErrorType';
7
8export default class OCPPError extends BaseError {
9 code: ErrorType | IncomingRequestCommand;
10 command?: RequestCommand | IncomingRequestCommand;
11 details?: Record<string, unknown>;
12
13 constructor(code: ErrorType | IncomingRequestCommand, message: string, command?: RequestCommand | IncomingRequestCommand, details?: Record<string, unknown>) {
14 super(message);
15
16 this.code = code ?? ErrorType.GENERIC_ERROR;
17 this.command = command;
18 this.details = details ?? {};
19 }
20}