From 962bd72e4b265c176be1476479358c27c9c7bf84 Mon Sep 17 00:00:00 2001 From: Jelle De Loecker Date: Wed, 20 Mar 2024 16:28:26 +0100 Subject: [PATCH] =?UTF-8?q?=F0=9F=A7=91=E2=80=8D=F0=9F=92=BB=20Add=20more?= =?UTF-8?q?=20info=20to=20the=20`setAbstractMethod`=20error?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/function_inheritance.js | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/lib/function_inheritance.js b/lib/function_inheritance.js index 9ea3393..1c1b0f9 100644 --- a/lib/function_inheritance.js +++ b/lib/function_inheritance.js @@ -1778,14 +1778,22 @@ defClassMethod(function decorateMethod(constructor, decorator, key, method) { * * @author Jelle De Loecker * @since 0.7.18 - * @version 0.7.18 + * @version 0.9.3 * * @param {Function} constructor Constructor to modify prototype of * @param {string} name The name of the method */ defClassMethod(function setAbstractMethod(constructor, name) { Fn.setMethod(constructor, name, function abstractMethod() { - let message = 'The `' + name + '` method has not been implemented in the `' + this.constructor.name + '` class.'; + let name = this.constructor.namespace; + + if (name) { + name += '.' + this.constructor.name; + } else { + name = this.constructor.name; + } + + let message = 'The `' + name + '` method has not been implemented in the `' + name + '` class.'; throw new Error(message); }); });