From 4bc4d11ab5d76beb7c4faebbc84caacbbca5b429 Mon Sep 17 00:00:00 2001 From: Wing-Kam Wong Date: Sat, 1 Apr 2023 17:45:46 +0800 Subject: [PATCH] fix(nocodb): throw errors for invokeWebhook --- packages/nocodb/src/lib/services/hook.svc.ts | 26 ++++++++++++-------- 1 file changed, 16 insertions(+), 10 deletions(-) diff --git a/packages/nocodb/src/lib/services/hook.svc.ts b/packages/nocodb/src/lib/services/hook.svc.ts index c6a5b2b559..c5a7c52a9a 100644 --- a/packages/nocodb/src/lib/services/hook.svc.ts +++ b/packages/nocodb/src/lib/services/hook.svc.ts @@ -81,20 +81,26 @@ export async function hookTest(param: { const model = await Model.getByIdOrName({ id: param.tableId }); + T.emit('evt', { evt_type: 'webhooks:tested' }); + const { hook, payload: { data, user }, } = param.hookTest; - await invokeWebhook( - new Hook(hook), - model, - data, - user, - (hook as any)?.filters, - true - ); - - T.emit('evt', { evt_type: 'webhooks:tested' }); + try { + await invokeWebhook( + new Hook(hook), + model, + null, + null, + data, + user, + (hook as any)?.filters, + true + ); + } catch (e) { + throw e; + } return true; }