Spaces:
Configuration error
Configuration error
File size: 434 Bytes
03b405b | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 | class AppError extends Error {
constructor(message, code = "APP_ERROR", details = {}) {
super(message);
this.name = "AppError";
this.code = code;
this.details = details;
}
}
function serializeError(error) {
return {
name: error?.name || "Error",
message: error?.message || String(error),
code: error?.code || "UNKNOWN",
stack: error?.stack
};
}
module.exports = { AppError, serializeError };
|