Apply dependencies update
[e-mobility-charging-stations-simulator.git] / src / exception / OCPPError.ts
CommitLineData
b4d34251
JB
1// Partial Copyright Jerome Benoit. 2021. All Rights Reserved.
2
e58068fd 3import { IncomingRequestCommand, RequestCommand } from '../types/ocpp/Requests';
a6b3c6c3 4
e58068fd
JB
5import BaseError from './BaseError';
6import { ErrorType } from '../types/ocpp/ErrorType';
5cc4b63b 7import { JsonType } from '../types/JsonType';
14763b46 8
e7accadb 9export default class OCPPError extends BaseError {
b3ec7bc1 10 code: ErrorType;
a6b3c6c3 11 command?: RequestCommand | IncomingRequestCommand;
5cc4b63b 12 details?: JsonType;
14763b46 13
e7aeea18 14 constructor(
b3ec7bc1 15 code: ErrorType,
e7aeea18
JB
16 message: string,
17 command?: RequestCommand | IncomingRequestCommand,
5cc4b63b 18 details?: JsonType
e7aeea18 19 ) {
14763b46
JB
20 super(message);
21
14763b46 22 this.code = code ?? ErrorType.GENERIC_ERROR;
9292e32a 23 this.command = command;
14763b46 24 this.details = details ?? {};
14763b46
JB
25 }
26}