@sidequest/core
Version:
@sidequest/core is the core package of SideQuest, a distributed background job queue for Node.js and TypeScript applications.
17 lines (14 loc) • 623 B
TypeScript
import { ErrorData } from '../schema/error-data.js';
/**
* Generate serializable errors.
* Error objects are not fully serializable by default because their fields are not enumerable.
* For example:
* const err = new Error("my error");
* const foo = { ...err }; // foo is {}
* JSON.stringify(err); // returns '{}'
* This function extracts all own properties, making the error serializable for logs and transport.
* @param err The error object to serialize.
* @returns A serializable error data object.
*/
declare function serializeError(err: Error): ErrorData;
export { serializeError };