From f799e224a079cb384d5fc13d48f012ee22b2bdfc Mon Sep 17 00:00:00 2001 From: Maidul Islam Date: Wed, 13 Dec 2023 18:22:29 -0500 Subject: [PATCH] use RequestError instead of Error for bot --- backend/src/helpers/bot.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/backend/src/helpers/bot.ts b/backend/src/helpers/bot.ts index 275ca0988..63814434d 100644 --- a/backend/src/helpers/bot.ts +++ b/backend/src/helpers/bot.ts @@ -13,7 +13,7 @@ import { SECRET_SHARED } from "../variables"; import { client, getEncryptionKey, getRootEncryptionKey } from "../config"; -import { InternalServerError } from "../utils/errors"; +import { BotNotFoundError, InternalServerError } from "../utils/errors"; import { Folder } from "../models"; import { getFolderByPath } from "../services/FolderService"; import { getAllImportedSecrets } from "../services/SecretImportService"; @@ -223,7 +223,7 @@ export const getKey = async ({ workspaceId }: { workspaceId: Types.ObjectId }) = workspace: workspaceId }).populate<{ sender: IUser }>("sender", "publicKey"); - if (!botKey) throw new Error("Failed to find bot key"); + if (!botKey) throw BotNotFoundError({ message: `getKey: Failed to find bot key for [workspaceId=${workspaceId}]` }) const bot = await Bot.findOne({ workspace: workspaceId