From f14c8249dfd7bbd1385bbf3513b2b3d5e0e6860c Mon Sep 17 00:00:00 2001 From: Alex Potsides Date: Tue, 9 Apr 2024 20:25:25 +0100 Subject: [PATCH] fix: throw read error on read error (#304) Fixes #299 --- packages/datastore-idb/src/index.ts | 2 +- packages/datastore-level/src/index.ts | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/datastore-idb/src/index.ts b/packages/datastore-idb/src/index.ts index b6b2e935..02c3c7d8 100644 --- a/packages/datastore-idb/src/index.ts +++ b/packages/datastore-idb/src/index.ts @@ -114,7 +114,7 @@ export class IDBDatastore extends BaseDatastore { try { await this.db.delete(this.location, key.toString()) } catch (err: any) { - throw Errors.dbWriteFailedError(err) + throw Errors.dbDeleteFailedError(err) } } diff --git a/packages/datastore-level/src/index.ts b/packages/datastore-level/src/index.ts index 66d8411a..b6368118 100644 --- a/packages/datastore-level/src/index.ts +++ b/packages/datastore-level/src/index.ts @@ -118,7 +118,7 @@ export class LevelDatastore extends BaseDatastore { throw Errors.notFoundError(err) } - throw Errors.dbWriteFailedError(err) + throw Errors.dbReadFailedError(err) } return data }