mirror of
https://github.com/pacnpal/Roo-Code.git
synced 2025-12-22 05:11:06 -05:00
25 lines
497 B
JavaScript
25 lines
497 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
|
|
}; |