mirror of
https://github.com/pacnpal/Roo-Code.git
synced 2025-12-20 20:31:37 -05:00
26 lines
463 B
JavaScript
26 lines
463 B
JavaScript
function serializeError(error) {
|
|
if (error instanceof Error) {
|
|
return {
|
|
name: error.name,
|
|
message: error.message,
|
|
stack: error.stack,
|
|
}
|
|
}
|
|
return error
|
|
}
|
|
|
|
function deserializeError(errorData) {
|
|
if (errorData && typeof errorData === "object") {
|
|
const error = new Error(errorData.message)
|
|
error.name = errorData.name
|
|
error.stack = errorData.stack
|
|
return error
|
|
}
|
|
return errorData
|
|
}
|
|
|
|
module.exports = {
|
|
serializeError,
|
|
deserializeError,
|
|
}
|