From fbfa762afaaf02e7fd9d6477740f0005a8144853 Mon Sep 17 00:00:00 2001 From: 0fatal <72899968+0fatal@users.noreply.github.com> Date: Thu, 7 Mar 2024 11:28:18 +0800 Subject: [PATCH] fix(runtime): print error when invoke init function error (#1887) --- runtimes/nodejs/src/support/init-hook.ts | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/runtimes/nodejs/src/support/init-hook.ts b/runtimes/nodejs/src/support/init-hook.ts index 6ca91dbe66..05071ff83c 100644 --- a/runtimes/nodejs/src/support/init-hook.ts +++ b/runtimes/nodejs/src/support/init-hook.ts @@ -12,7 +12,7 @@ export class InitHook { return } const executor = new FunctionExecutor(func) - await executor.invoke( + const result = await executor.invoke( { method: 'INIT', __function_name: func.name, @@ -20,6 +20,10 @@ export class InitHook { false, ) + if (result.error) { + return logger.error(result.error) + } + logger.info('__init__ hook invoked') } }