@sidequest/core
Version:
@sidequest/core is the core package of SideQuest, a distributed background job queue for Node.js and TypeScript applications.
22 lines (18 loc) • 549 B
JavaScript
;
var serializeError = require('./serialize-error.cjs');
/**
* Converts a string, Error, or ErrorData to ErrorData format.
* @param error The error input (string, Error, or ErrorData).
* @returns The error as ErrorData.
*/
function toErrorData(error) {
if (error instanceof Error) {
return serializeError.serializeError(error);
}
else if (typeof error === "string") {
return { message: error };
}
return error;
}
exports.toErrorData = toErrorData;
//# sourceMappingURL=parse-error-data.cjs.map