1.0.4 • Published 4 years ago

@yo1dog/extendable-error v1.0.4

Weekly downloads
10
License
ISC
Repository
github
Last release
4 years ago

node-extendable-error

Quick Start

const ExtendableError = require('@yo1dog/extendable-error');

class MyError extends ExtendableError {
  constructor(message) {
    super(message);
  }
}

throw new MyError('hello world');

/*
MyError: hello world
    at readme.js:9:1
    at Script.runInThisContext (vm.js:123:20)
    ...
*/

Docs

ExtendableError.setUnenumerable(obj, key, value)

paramtypedescription
objObjectObject to modify.
keystring/number/SymbolKey to modify.
valueanyValue to set.

Sets a property on the given object and makes it unenumerable.

Equivalent to:

obj[key] = value;
Object.defineProperty(obj, key, {enumerable: false});

ExtendableError.makeUnenumerable(obj, key)

paramtypedescription
objObjectObject to modify.
keystring/number/SymbolKey to modify.

Sets makes a property on the given object unenumerable.

Equivalent to:

Object.defineProperty(obj, key, {enumerable: false});

ExtendableError.prototype.setUnenumerable(key, value)

paramtypedescription
keystring/number/SymbolKey to modify.
valueanyValue to set.

Equivalent to:

ExtendableError.setUnenumerable(this, key, value);

ExtendableError.prototype.makeUnenumerable(key)

paramtypedescription
keystring/number/SymbolKey to modify.

Equivalent to:

ExtendableError.makeUnenumerable(this, key);