Skip to content

Commit

Permalink
Fix
Browse files Browse the repository at this point in the history
  • Loading branch information
Hexagon committed Nov 14, 2024
1 parent 3a9d39f commit 75a1e78
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions lib/cli/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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)
}
}
Expand All @@ -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) {
Expand All @@ -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)
}
}
Expand Down

0 comments on commit 75a1e78

Please sign in to comment.