]>
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 | ||
5 | import { Constants } from '../utils/index.js' | |
6 | import { BaseError } from './BaseError.js' | |
7 | ||
8 | export class OCPPError extends BaseError { | |
9 | code: ErrorType | |
10 | command: IncomingRequestCommand | RequestCommand | |
11 | details?: JsonType | |
12 | ||
13 | constructor ( | |
14 | code: ErrorType, | |
15 | message: string, | |
16 | command?: IncomingRequestCommand | RequestCommand, | |
17 | details?: JsonType | |
18 | ) { | |
19 | super(message) | |
20 | ||
21 | this.code = code | |
22 | this.command = command ?? Constants.UNKNOWN_OCPP_COMMAND | |
23 | this.details = details | |
24 | } | |
25 | } |