fix: error handling

pull/249/head
Sylvie 12 months ago
parent 7cd56bc4ed
commit dd050b6d37
No known key found for this signature in database
GPG Key ID: 75AB0FE5B983A3AF

@ -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);
});
}

Loading…
Cancel
Save