From 7879dffc3c76ed3508163d940e1a01abba18aab0 Mon Sep 17 00:00:00 2001 From: Vyacheslav Tumanov Date: Thu, 25 Jan 2024 14:09:28 +0500 Subject: [PATCH] throw error after catch (#4442) Signed-off-by: Vyacheslav Tumanov --- server/mongo/src/storage.ts | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/server/mongo/src/storage.ts b/server/mongo/src/storage.ts index 3b28a62b30..977ce40346 100644 --- a/server/mongo/src/storage.ts +++ b/server/mongo/src/storage.ts @@ -601,13 +601,14 @@ abstract class MongoAdapterBase implements DbAdapter { let res: T[] = [] try { res = await cursor.toArray() + if (options?.total === true && options?.limit === undefined) { + total = res.length + } + return toFindResult(this.stripHash(res), total) } catch (e) { console.error('error during executing cursor in findAll', _class, cutObjectArray(query), options, e) + throw e } - if (options?.total === true && options?.limit === undefined) { - total = res.length - } - return toFindResult(this.stripHash(res), total) } stripHash(docs: T[]): T[] {