UNPKG

serialize-error-cjs

Version:

> Serialize/deserialize an error into a plain object in commonjs

12 lines (11 loc) 384 B
import { errorConstructors } from './constructors'; export { errorConstructors }; export type SerializedError = { name: string; message: string; stack: string; code?: string | number; cause?: string; }; export declare function serializeError(subject: Error): SerializedError; export declare function deserializeError<T extends Error>(subject: SerializedError): T;