Skip to content

EspoCRM – Open Source CRM Application

Action handler error

Yurii04c85a2fdfb6
diff --git a/client/src/utils.ts b/client/src/utils.ts
index 4314b79840..78ccf4459d 100644
--- a/client/src/utils.ts
+++ b/client/src/utils.ts
@@ -196,9 +196,13 @@ const Utils = {
fired = true;
Espo.loader.require(handler, Handler => {
- const handler = new Handler(view);
+ const handlerInstance = new Handler(view);
- handler[method].call(handler, data, event);
+ if (!(method in handlerInstance)) {
+ throw new Error(`No method '${method}' in action handler '${handler}'.`);
+ }
+
+ handlerInstance[method].call(handlerInstance, data, event);
});
} else if (
// @ts-ignore