1.1.0 • Published 4 years ago

err2obj v1.1.0

Weekly downloads
3
License
MIT
Repository
github
Last release
4 years ago

err2obj

A tiny tool transfer an Error instance to plain object, and vice versa.

This tool is used when you need to jsonify an error instance and recover it afterwards

export type ErrorObject = Required<Error> & { [prop: string]: any };

export declare function err2obj(err: any): ErrorObject;
export declare function obj2err(err: any): ErrorObject;
export declare function register(errType: new (...args: any) => Error): void;