Skip to content

Commit

Permalink
πŸ§‘β€πŸ’» Add more info to the setAbstractMethod error
Browse files Browse the repository at this point in the history
  • Loading branch information
skerit committed Mar 20, 2024
1 parent 2bae45d commit 962bd72
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions lib/function_inheritance.js
Original file line number Diff line number Diff line change
Expand Up @@ -1778,14 +1778,22 @@ defClassMethod(function decorateMethod(constructor, decorator, key, method) {
*
* @author Jelle De Loecker <[email protected]>
* @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);
});
});
Expand Down

0 comments on commit 962bd72

Please sign in to comment.