diff options
author | Bert Belder <bertbelder@gmail.com> | 2021-01-08 16:57:37 -0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-01-09 01:57:37 +0100 |
commit | f3ead9c6a7184d2b592f018795f73d34399a9c83 (patch) | |
tree | 15c5ca5b4eef85bf9bda4673176cd34346f91edd | |
parent | 9cf82d3c662989f5fffa8d1981233979245af84a (diff) |
refactor: Print cause chain when downcasting AnyError fails (#9059)
-rw-r--r-- | cli/errors.rs | 8 | ||||
-rw-r--r-- | cli/standalone.rs | 8 |
2 files changed, 14 insertions, 2 deletions
diff --git a/cli/errors.rs b/cli/errors.rs index 29fd428c8..b631f1b71 100644 --- a/cli/errors.rs +++ b/cli/errors.rs @@ -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>() + ); }) } diff --git a/cli/standalone.rs b/cli/standalone.rs index a4b55f081..48a4a28b3 100644 --- a/cli/standalone.rs +++ b/cli/standalone.rs @@ -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>() + ); }) } |