Licence
MIT
Version
0.1.0
Deps
0
Size
3 kB
Vulns
0
Weekly
0
err-json
Convert Error to JSON.
Installation
npm i err-json
Usage
const {
errJson,
errJsonDebug,
} = require('err-json');
const json1 = errJson(err);
const json2 = errJson(err, true);
errJson(err)
Returns an object with the following properties:
name- A name of the error.
message- Error message.
code- Error code.
errJsonDebug(err, split = false)
Returns an object with the following properties:
name- A name of the error.
message- Error message.
code- Error code.
stack- Stack trace.
- If the argument
splitis true, it is returned as an array.
License
MIT