Skip to content

Commit 654bf3a

Browse files
authored
chore: Warn instead of panicking if we fail to make JsStackFrame (#876)
1 parent e6183a8 commit 654bf3a

File tree

1 file changed

+12
-4
lines changed

1 file changed

+12
-4
lines changed

core/error.rs

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -653,9 +653,13 @@ impl JsError {
653653
"JsStackFrame::from_callsite_object raised an exception",
654654
)
655655
.to_rust_string_lossy(tc_scope);
656-
panic!(
657-
"Failed to create JsStackFrame from callsite object: {message}"
658-
);
656+
#[allow(clippy::print_stderr)]
657+
{
658+
eprintln!(
659+
"warning: Failed to create JsStackFrame from callsite object: {message}. This is a bug in deno"
660+
);
661+
}
662+
break;
659663
};
660664
buf.push(stack_frame);
661665
}
@@ -1317,7 +1321,11 @@ fn format_stack_trace<'s>(
13171321
.exception()
13181322
.expect("JsStackFrame::from_callsite_object raised an exception")
13191323
.to_rust_string_lossy(tc_scope);
1320-
panic!("Failed to create JsStackFrame from callsite object: {message}");
1324+
#[allow(clippy::print_stderr)]
1325+
{
1326+
eprintln!("warning: Failed to create JsStackFrame from callsite object: {message}; Result so far: {result}. This is a bug in deno");
1327+
}
1328+
break;
13211329
};
13221330
write!(result, "\n at {}", format_frame::<NoAnsiColors>(&frame))
13231331
.unwrap();

0 commit comments

Comments
 (0)