change check for commandClass

This commit is contained in:
clauspeterhuebner 2026-02-10 02:42:39 +01:00
parent 7615d6efb1
commit 92077f954d

View File

@ -27,7 +27,7 @@ export class CommandFactory {
} }
this.commands.set(name, commandClass); this.commands.set(name, commandClass);
if (methodLogger.isDebugEnabled()) { if (methodLogger.isDebugEnabled()) {
methodLogger.debug(`registerCommand() commands=${JSON.stringify(Array.from(this.commands.entries()))}`) methodLogger.debug(`registerCommand() commands=${JSON.stringify(this.commands.entries())}`)
} }
} }
@ -38,9 +38,9 @@ export class CommandFactory {
} }
const CommandClass = this.commands.get(name); const CommandClass = this.commands.get(name);
if (methodLogger.isDebugEnabled()) { if (methodLogger.isDebugEnabled()) {
methodLogger.debug(`createCommand() name=${name} commandClass=${CommandClass ? JSON.stringify(CommandClass) : 'null'}`) methodLogger.debug(`createCommand() name=${name} commandClass=${CommandClass ? CommandClass.name : 'null'}`)
} }
if (!CommandClass) { if (CommandClass === undefined) {
const errmsg = `Command ${name} not found`; const errmsg = `Command ${name} not found`;
methodLogger.error(errmsg); methodLogger.error(errmsg);
throw new Error(errmsg); throw new Error(errmsg);