Skip to content

Commit

Permalink
Fix bug in config, improve logging.
Browse files Browse the repository at this point in the history
Resolves #536 and additionally adds a debug message that logs errors
when they are handled by guard.
  • Loading branch information
SpacingBat3 committed May 3, 2024
1 parent 22d0e27 commit ba5415f
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions sources/code/main/modules/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -156,10 +156,14 @@ class Config<T> {
#read(): unknown {
const encodedData = readFileSync(this.#path+this.#pathExtension);
let decodedData = encodedData.toString();
if(this.#pathExtension === FileExt.Encrypted) try {
decodedData = safeStorage.decryptString(encodedData);
try {
if(this.#pathExtension === FileExt.Encrypted)
decodedData = safeStorage.decryptString(encodedData);
return JSON.parse(decodedData);
} catch {}
} catch(err) {
console.debug("[Config] Error in #read during config decoding.");
console.debug(err);
}
return {};
}
/**
Expand Down

0 comments on commit ba5415f

Please sign in to comment.