fix: print console.error with updated stack

pull/16149/head
paoloricciuti 3 months ago
parent cd32c37fc1
commit 0161aa3b23

@ -67,7 +67,6 @@ function adjust_error(error, effect) {
// if the message was already changed and it's not configurable we can't change it // if the message was already changed and it's not configurable we can't change it
// or it will throw a different error swallowing the original one // or it will throw a different error swallowing the original one
if (message_descriptor && !message_descriptor.configurable) return;
var indent = is_firefox ? ' ' : '\t'; var indent = is_firefox ? ' ' : '\t';
var component_stack = `\n${indent}in ${effect.fn?.name || '<unknown>'}`; var component_stack = `\n${indent}in ${effect.fn?.name || '<unknown>'}`;
@ -78,9 +77,18 @@ function adjust_error(error, effect) {
context = context.p; context = context.p;
} }
define_property(error, 'message', { if (!message_descriptor || message_descriptor.configurable) {
value: error.message + `\n${component_stack}\n` define_property(error, 'message', {
}); value: error.message + `\n${component_stack}\n`
});
} else {
// eslint-disable-next-line no-console
console.error(
"The following it's not a separate error: we usually modify the error message to show you this information but `message` was non configurable so we print them in a separate log.\n" +
error.message +
`\n${component_stack}\n`
);
}
if (error.stack) { if (error.stack) {
// Filter out internal modules // Filter out internal modules

Loading…
Cancel
Save