Commit | Line | Data |
---|---|---|
edd13439 | 1 | // Partial Copyright Jerome Benoit. 2021-2023. All Rights Reserved. |
b4d34251 | 2 | |
268a74bb JB |
3 | import { BaseError } from './BaseError'; |
4 | import { | |
5 | ErrorType, | |
6 | type IncomingRequestCommand, | |
7 | type JsonType, | |
8 | type RequestCommand, | |
9 | } from '../types'; | |
14763b46 | 10 | |
268a74bb | 11 | export class OCPPError extends BaseError { |
b3ec7bc1 | 12 | code: ErrorType; |
a6b3c6c3 | 13 | command?: RequestCommand | IncomingRequestCommand; |
5cc4b63b | 14 | details?: JsonType; |
14763b46 | 15 | |
e7aeea18 | 16 | constructor( |
b3ec7bc1 | 17 | code: ErrorType, |
e7aeea18 JB |
18 | message: string, |
19 | command?: RequestCommand | IncomingRequestCommand, | |
5cc4b63b | 20 | details?: JsonType |
e7aeea18 | 21 | ) { |
14763b46 JB |
22 | super(message); |
23 | ||
14763b46 | 24 | this.code = code ?? ErrorType.GENERIC_ERROR; |
9292e32a | 25 | this.command = command; |
14763b46 | 26 | this.details = details ?? {}; |
14763b46 JB |
27 | } |
28 | } |