mirror of
https://github.com/denoland/deno.git
synced 2024-12-22 15:24:46 -05:00
refactor: Print cause chain when downcasting AnyError fails (#9059)
This commit is contained in:
parent
9cf82d3c66
commit
f3ead9c6a7
2 changed files with 14 additions and 2 deletions
|
@ -32,6 +32,12 @@ pub(crate) fn get_error_class_name(e: &AnyError) -> &'static str {
|
|||
.map(get_diagnostic_class)
|
||||
})
|
||||
.unwrap_or_else(|| {
|
||||
panic!("Error '{}' contains boxed error of unknown type", e);
|
||||
panic!(
|
||||
"Error '{}' contains boxed error of unknown type:{}",
|
||||
e,
|
||||
e.chain()
|
||||
.map(|e| format!("\n {:?}", e))
|
||||
.collect::<String>()
|
||||
);
|
||||
})
|
||||
}
|
||||
|
|
|
@ -201,6 +201,12 @@ pub async fn run(
|
|||
|
||||
fn get_error_class_name(e: &AnyError) -> &'static str {
|
||||
deno_runtime::errors::get_error_class_name(e).unwrap_or_else(|| {
|
||||
panic!("Error '{}' contains boxed error of unknown type", e);
|
||||
panic!(
|
||||
"Error '{}' contains boxed error of unsupported type:{}",
|
||||
e,
|
||||
e.chain()
|
||||
.map(|e| format!("\n {:?}", e))
|
||||
.collect::<String>()
|
||||
);
|
||||
})
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue