refactor: cleanup string literal variables handling
[e-mobility-charging-stations-simulator.git] / src / charging-station / ui-server / AbstractUIServer.ts
index b2a5b44e5e508a2ab8751c81edfc6d3e467a1a36..a786fbbddc2ed43623316f297a7f5ac94503d474 100644 (file)
@@ -8,6 +8,7 @@ import {
   ApplicationProtocolVersion,
   AuthenticationType,
   type ChargingStationData,
+  ConfigurationSection,
   type ProcedureName,
   type ProtocolRequest,
   type ProtocolResponse,
@@ -46,7 +47,7 @@ export abstract class AbstractUIServer {
         break
       default:
         throw new BaseError(
-          `Unsupported application protocol version ${this.uiServerConfiguration.version}`
+          `Unsupported application protocol version ${this.uiServerConfiguration.version} in '${ConfigurationSection.uiServer}' configuration section`
         )
     }
     this.responseHandlers = new Map<
@@ -165,7 +166,9 @@ export abstract class AbstractUIServer {
     const authorizationProtocol = req.headers['sec-websocket-protocol']?.split(/,\s+/).pop()
     const [username, password] = getUsernameAndPasswordFromAuthorizationToken(
       // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
-      `${authorizationProtocol}${Array(((4 - (authorizationProtocol!.length % 4)) % 4) + 1).join('=')}`
+      `${authorizationProtocol}${Array(((4 - (authorizationProtocol!.length % 4)) % 4) + 1).join(
+        '='
+      )}`
         .split('.')
         .pop() ?? '',
       next