]> Piment Noir Git Repositories - e-mobility-charging-stations-simulator.git/commit
refactor: replace 54 unsafe error casts with instanceof guards
authorJérôme Benoit <jerome.benoit@sap.com>
Sun, 15 Mar 2026 23:13:20 +0000 (00:13 +0100)
committerJérôme Benoit <jerome.benoit@sap.com>
Sun, 15 Mar 2026 23:13:20 +0000 (00:13 +0100)
commit2bcd07d72f3b715792897782d43750db25ee0103
treeb01295889afa690c40a8e15bc796a143cb7794b1
parentef86be68d6b8ed032921d85b37315629ad6cf0f2
refactor: replace 54 unsafe error casts with instanceof guards

All 'error as Error', 'error as OCPPError', and 'error as
NodeJS.ErrnoException' casts replaced with proper instanceof
type narrowing across 16 files. Uses the pattern already
established in the auth strategies module:
  error instanceof Error ? error.message : String(error)

For call sites that pass error objects to functions, wraps
non-Error values: error instanceof Error ? error : new Error(String(error))
16 files changed:
src/charging-station/ChargingStation.ts
src/charging-station/ChargingStationWorker.ts
src/charging-station/IdTagsCache.ts
src/charging-station/broadcast-channel/ChargingStationWorkerBroadcastChannel.ts
src/charging-station/ocpp/1.6/OCPP16IncomingRequestService.ts
src/charging-station/ocpp/2.0/OCPP20CertificateManager.ts
src/charging-station/ocpp/OCPPRequestService.ts
src/charging-station/ocpp/auth/services/OCPPAuthServiceImpl.ts
src/charging-station/ui-server/UIHttpServer.ts
src/charging-station/ui-server/UIServerUtils.ts
src/charging-station/ui-server/ui-services/AbstractUIService.ts
src/performance/storage/JsonFileStorage.ts
src/performance/storage/MikroOrmStorage.ts
src/performance/storage/MongoDBStorage.ts
src/utils/Configuration.ts
src/utils/FileUtils.ts