{"repo":"ehmicky/error-serializer","free":true,"listed":false,"github":"https://github.com/ehmicky/error-serializer","clone":"git clone https://github.com/ehmicky/error-serializer.git","description":"Convert errors to/from plain objects.","language":"JavaScript","stars":17,"topics":["convert","error","error-handling","error-monitoring","error-reporting","errors","exception-handling","javascript","json","library"],"license":"MIT","category":"analytics","readme_excerpt":"Convert errors to/from plain objects. Features - Ensures errors are safe to serialize with JSON - Can be used as error.toJSON() - Deep serialization/parsing, including transforming - Custom serialization/parsing (e.g. YAML or process.send() ) - Keeps both native ( TypeError , etc.) and custom error classes - Preserves errors' additional properties - Can keep constructor's arguments - Works recursively with error.cause and AggregateError - Normalizes invalid errors - Safe: this never throws Example Install This package works in both Node.js =18.18.0 and browsers. This is an ES module. It must be loaded using an import or import() statement, not require() . If TypeScript is used, it must be configured to output ES modules, not CommonJS. API serialize(errorInstance, options?) errorInstance any \\ options Options? \\ Return value : ErrorObject Convert an Error instance into a plain object. Options Object with the following optional properties. shallow Type : boolean \\ Default : false Unless this option is true , nested errors are also serialized. They can be inside other errors, plain objects or arrays. loose Type : boolean \\ Default : false By default, when the argument is not an Error instance, it is converted to one. If this option is true , it is kept as is instead. include Type : string[] Only pick specific properties. exclude Type : string[] Omit specific properties. transformObject(errorObject, errorInstance) Type : (errorObject, errorInstance) = void Transform each error pl","default_branch":null,"files":null,"tree":[],"storefront":"/r/ehmicky","claimed":false,"request_supported":{"post":"https://gitbuyer.com/r/ehmicky/error-serializer/request-supported","requests":0},"note":"indexed from public GitHub; nothing is for sale on this page. Clone it from GitHub. Paid listings live at /search."}