Lines Matching full:errors
1 # Using the internal/errors.js module
3 ## What is internal/errors.js
5 The `require('internal/errors')` module is an internal-only module that can be
9 The intent of the module is to allow errors provided by Node.js to be assigned a
17 Switching an existing error to use the `internal/errors` module must be
20 ## Using internal/errors.js
22 The `internal/errors` module exposes all custom errors as subclasses of the
23 builtin errors. After being added, an error can be found in the `codes` object.
31 Can be replaced by first adding a new error key into the `internal/errors.js`
41 const { FOO } = require('internal/errors').codes;
46 ## Adding new errors
48 New static error codes are added by modifying the `internal/errors.js` file
59 additional arguments passed to the `errors.message()` function (which is
60 used by the `errors.Error`, `errors.TypeError` and `errors.RangeError` classes),
73 const { EXAMPLE_KEY } = require('internal/errors').codes;
80 ## Documenting new errors
83 for the error code should be added to the `doc/api/errors.md` file. This will
87 ## Testing new errors
102 `test/parallel/test-internal-errors.js`. These tests should validate
109 errors.message('ERR_TLS_CERT_ALTNAME_INVALID', ['altname']),
135 ### Object: errors.codes
139 ### Method: errors.message(key, args)