HEX
Server: Apache/2.4.41 (Ubuntu)
System: Linux wordpress-ubuntu-s-2vcpu-4gb-fra1-01 5.4.0-169-generic #187-Ubuntu SMP Thu Nov 23 14:52:28 UTC 2023 x86_64
User: root (0)
PHP: 7.4.33
Disabled: pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_get_handler,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,pcntl_async_signals,pcntl_unshare,
Upload Files
File: /var/www/zaklada/html/node_modules/makeerror/readme.md
makeerror [![Build Status](https://secure.travis-ci.org/nshah/nodejs-makeerror.png)](http://travis-ci.org/nshah/nodejs-makeerror)
=========

A library to make errors.


Basics
------

Makes an Error constructor function with the signature below. All arguments are
optional, and if the first argument is not a `String`, it will be assumed to be
`data`:

```javascript
function(message, data)
```

You'll typically do something like:

```javascript
var makeError = require('makeerror')
var UnknownFileTypeError = makeError(
  'UnknownFileTypeError',
  'The specified type is not known.'
)
var er = UnknownFileTypeError()
```

`er` will have a prototype chain that ensures:

```javascript
er instanceof UnknownFileTypeError
er instanceof Error
```


Templatized Error Messages
--------------------------

There is support for simple string substitutions like:

```javascript
var makeError = require('makeerror')
var UnknownFileTypeError = makeError(
  'UnknownFileTypeError',
  'The specified type "{type}" is not known.'
)
var er = UnknownFileTypeError({ type: 'bmp' })
```

Now `er.message` or `er.toString()` will return `'The specified type "bmp" is
not known.'`.


Prototype Hierarchies
---------------------

You can create simple hierarchies as well using the `prototype` chain:

```javascript
var makeError = require('makeerror')
var ParentError = makeError('ParentError')
var ChildError = makeError(
  'ChildError',
  'The child error.',
  { proto: ParentError() }
)
var er = ChildError()
```

`er` will have a prototype chain that ensures:

```javascript
er instanceof ChildError
er instanceof ParentError
er instanceof Error
```