import chalk from 'chalk'
-import { logger } from './Logger.js'
-import { isNotEmptyString } from './Utils.js'
import type { ChargingStation } from '../charging-station/index.js'
import type {
EmptyObject,
JsonType,
RequestCommand
} from '../types/index.js'
+import { logger } from './Logger.js'
+import { isNotEmptyString } from './Utils.js'
const defaultErrorParams = {
throwError: true,
consoleOut: false
-}
+} satisfies HandleErrorParams<EmptyObject>
export const handleUncaughtException = (): void => {
process.on('uncaughtException', (error: Error) => {
chargingStation: ChargingStation,
commandName: RequestCommand | IncomingRequestCommand,
error: Error,
- params: HandleErrorParams<EmptyObject> = { throwError: false, consoleOut: false }
+ params: HandleErrorParams<EmptyObject> = {
+ throwError: false,
+ consoleOut: false
+ }
): void => {
setDefaultErrorParams(params, { throwError: false, consoleOut: false })
logger.error(`${chargingStation.logPrefix()} Request command '${commandName}' error:`, error)