From ad60f8a8119103478cc46f992e8edee3182b813d Mon Sep 17 00:00:00 2001 From: mike12345567 Date: Tue, 24 Sep 2024 15:47:07 +0100 Subject: [PATCH] All docs returns no docs if 404. --- .../backend-core/src/db/couch/DatabaseImpl.ts | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/packages/backend-core/src/db/couch/DatabaseImpl.ts b/packages/backend-core/src/db/couch/DatabaseImpl.ts index 180cd22efa..650f5ca8b6 100644 --- a/packages/backend-core/src/db/couch/DatabaseImpl.ts +++ b/packages/backend-core/src/db/couch/DatabaseImpl.ts @@ -336,7 +336,21 @@ export class DatabaseImpl implements Database { params: DatabaseQueryOpts ): Promise> { return this.performCall(db => { - return () => db.list(params) + return async () => { + try { + return (await db.list(params)) as AllDocsResponse + } catch (err: any) { + if (err.status === 404) { + return { + offset: 0, + total_rows: 0, + rows: [], + } + } else { + throw err + } + } + } }) }