]>
Commit | Line | Data |
---|---|---|
1 | // Partial Copyright Jerome Benoit. 2021-2024. All Rights Reserved. | |
2 | ||
3 | import type { ErrorType, IncomingRequestCommand, JsonType, RequestCommand } from '../types/index.js' | |
4 | import { Constants } from '../utils/index.js' | |
5 | import { BaseError } from './BaseError.js' | |
6 | ||
7 | export class OCPPError extends BaseError { | |
8 | code: ErrorType | |
9 | command: RequestCommand | IncomingRequestCommand | |
10 | details?: JsonType | |
11 | ||
12 | constructor ( | |
13 | code: ErrorType, | |
14 | message: string, | |
15 | command?: RequestCommand | IncomingRequestCommand, | |
16 | details?: JsonType | |
17 | ) { | |
18 | super(message) | |
19 | ||
20 | this.code = code | |
21 | this.command = command ?? Constants.UNKNOWN_OCPP_COMMAND | |
22 | this.details = details | |
23 | } | |
24 | } |