mirror of
https://github.com/n8n-io/n8n.git
synced 2025-01-12 21:37:32 -08:00
fix: wrap external hooks calls in a try catch (#4208)
This commit is contained in:
parent
80e2d65933
commit
ef378f2cf2
|
@ -2,6 +2,7 @@
|
|||
/* eslint-disable import/no-dynamic-require */
|
||||
/* eslint-disable no-restricted-syntax */
|
||||
// eslint-disable-next-line import/no-cycle
|
||||
import { LoggerProxy } from 'n8n-workflow';
|
||||
import { Db, IExternalHooksClass, IExternalHooksFileData, IExternalHooksFunctions } from '.';
|
||||
|
||||
import config from '../config';
|
||||
|
@ -87,8 +88,13 @@ class ExternalHooksClass implements IExternalHooksClass {
|
|||
}
|
||||
|
||||
for (const externalHookFunction of this.externalHooks[hookName]) {
|
||||
// eslint-disable-next-line no-await-in-loop
|
||||
await externalHookFunction.apply(externalHookFunctions, hookParameters);
|
||||
try {
|
||||
// eslint-disable-next-line no-await-in-loop
|
||||
await externalHookFunction.apply(externalHookFunctions, hookParameters);
|
||||
} catch (error) {
|
||||
// eslint-disable-next-line @typescript-eslint/no-unsafe-member-access, @typescript-eslint/restrict-template-expressions
|
||||
LoggerProxy.info(`Error in external hook "${hookName}": ${error.message}`);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue