From 7b9886b4b0650af56b52a1466372e0ae0af0c14f Mon Sep 17 00:00:00 2001 From: Michal Orlik Date: Mon, 2 Dec 2019 11:14:29 +0100 Subject: [PATCH 1/2] fix(api): set better error message Fixes #3039 --- src/bot/api.ts | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/bot/api.ts b/src/bot/api.ts index d79a44564d5..754e85da9f2 100644 --- a/src/bot/api.ts +++ b/src/bot/api.ts @@ -1009,7 +1009,11 @@ class API extends Core { justStarted = true; for (const event of getFunctionList('streamStart')) { - this[event.fName](); + if (typeof this[event.fName]) { + this[event.fName](); + } else { + throw new Error(`!!! Event ${event.path} don't have function ${event.fName} !!!`); + } } } } From 0d99e5454ae24e4e6f62217ea969541bc3a6489e Mon Sep 17 00:00:00 2001 From: Michal Orlik Date: Mon, 2 Dec 2019 11:45:04 +0100 Subject: [PATCH 2/2] fix if --- src/bot/api.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/bot/api.ts b/src/bot/api.ts index 754e85da9f2..0fe0ab44631 100644 --- a/src/bot/api.ts +++ b/src/bot/api.ts @@ -1009,7 +1009,7 @@ class API extends Core { justStarted = true; for (const event of getFunctionList('streamStart')) { - if (typeof this[event.fName]) { + if (typeof this[event.fName] === 'function') { this[event.fName](); } else { throw new Error(`!!! Event ${event.path} don't have function ${event.fName} !!!`);