From 75a1e787152690d1e510139c4beda0e1f0e3e82f Mon Sep 17 00:00:00 2001 From: Hexagon Date: Thu, 14 Nov 2024 20:20:25 +0100 Subject: [PATCH] Fix --- lib/cli/config.ts | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/lib/cli/config.ts b/lib/cli/config.ts index 131d17e..58ed106 100644 --- a/lib/cli/config.ts +++ b/lib/cli/config.ts @@ -60,7 +60,7 @@ export async function appendConfigurationFile(configFile: string, checkedArgs: A const existingConfigurationText = new TextDecoder().decode(existingConfiguration) existingConfigurationObject = JSON5.parse(existingConfigurationText) as unknown as Configuration } catch (e) { - throw new Error("Could not read configuration file: " + e.message) + throw new Error("Could not read configuration file: " + (e instanceof Error ? e.message : "Unknown")) } // Check for valid parse @@ -97,7 +97,7 @@ export async function appendConfigurationFile(configFile: string, checkedArgs: A existingConfigurationObject.processes.push(newConfiguration.processes[0]) await writeFile(configFile, JSON.stringify(existingConfigurationObject, null, 2)) } catch (e) { - console.error(`Could not modify configuration file '${configFile}': `, e.message) + console.error(`Could not modify configuration file '${configFile}'`) exit(1) } } @@ -116,7 +116,7 @@ export async function removeFromConfigurationFile(configFile: string, checkedArg const existingConfigurationText = new TextDecoder().decode(existingConfiguration) existingConfigurationObject = JSON5.parse(existingConfigurationText) as unknown as Configuration } catch (e) { - throw new Error("Could not read configuration file.", e.message) + throw new Error("Could not read configuration file.") } if (!existingConfigurationObject) { @@ -135,7 +135,7 @@ export async function removeFromConfigurationFile(configFile: string, checkedArg // Append new process, and write configuration file await writeFile(configFile, JSON.stringify(existingConfigurationObject, null, 2)) } catch (e) { - console.error(`Could not modify configuration file ${configFile}: `, e.message) + console.error(`Could not modify configuration file ${configFile}: `, e instanceof Error ? e.message : "Unknown" ) exit(1) } }