serialize-error-cjs
Version:
> Serialize/deserialize an error into a plain object in commonjs
12 lines (11 loc) • 384 B
TypeScript
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;