From 7663e55a2cc46a413bceee2787d48902b15ae642 Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Mon, 22 Jul 2019 16:31:47 +0200 Subject: Log error on unknown hook --- client/src/app/core/plugins/plugin.service.ts | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'client/src/app/core') diff --git a/client/src/app/core/plugins/plugin.service.ts b/client/src/app/core/plugins/plugin.service.ts index 7c1d69bec..90ebe5669 100644 --- a/client/src/app/core/plugins/plugin.service.ts +++ b/client/src/app/core/plugins/plugin.service.ts @@ -8,7 +8,7 @@ import { RegisterHookOptions } from '@shared/models/plugins/register-hook.model' import { ReplaySubject } from 'rxjs' import { first, shareReplay } from 'rxjs/operators' import { getHookType, internalRunHook } from '@shared/core-utils/plugins/hooks' -import { ClientHook, ClientHookName } from '@shared/models/plugins/client-hook.model' +import { ClientHook, ClientHookName, clientHookObject } from '@shared/models/plugins/client-hook.model' import { PluginClientScope } from '@shared/models/plugins/plugin-client-scope.type' interface HookStructValue extends RegisterHookOptions { @@ -155,6 +155,11 @@ export class PluginService implements ClientHook { const { plugin, clientScript } = pluginInfo const registerHook = (options: RegisterHookOptions) => { + if (clientHookObject[options.target] !== true) { + console.error('Unknown hook %s of plugin %s. Skipping.', options.target, plugin.name) + return + } + if (!this.hooks[options.target]) this.hooks[options.target] = [] this.hooks[options.target].push({ -- cgit v1.2.3