Skip to content
This repository has been archived by the owner on Dec 19, 2024. It is now read-only.

Commit

Permalink
fix: error handling
Browse files Browse the repository at this point in the history
  • Loading branch information
tycrek committed Dec 4, 2023
1 parent 7cd56bc commit dd050b6
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion backend/sql/json.ts
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ export class JSONDatabase implements Database {
public get(table: DatabaseTable, key: string): Promise<DatabaseValue> {
return new Promise(async (resolve, reject) => {
const data = (await fs.readJson(PATHMAP[table]))[SECTORMAP[table]][key];
(!data) ? resolve(undefined) : resolve(data);
(!data) ? reject(new Error(`Key '${key}' not found in '${table}'`)) : resolve(data);
});
}

Expand Down

0 comments on commit dd050b6

Please sign in to comment.