diff options
author | Leo Kettmeir <crowlkats@toaxl.com> | 2024-11-06 16:57:57 -0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-11-06 16:57:57 -0800 |
commit | 1cab4f07a3e6125a089726f022dd6bc9af517536 (patch) | |
tree | 574a4d128c107f42d8c4478a240e4a4c05611e7c /cli/errors.rs | |
parent | db53ec230d2de1b3be50230d4c00e83a03df686f (diff) |
refactor: use concrete error type for remaining ops (#26746)
Diffstat (limited to 'cli/errors.rs')
-rw-r--r-- | cli/errors.rs | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/cli/errors.rs b/cli/errors.rs index 25b3fc332..b1808f733 100644 --- a/cli/errors.rs +++ b/cli/errors.rs @@ -88,6 +88,10 @@ fn get_resolution_error_class(err: &ResolutionError) -> &'static str { } } +fn get_try_from_int_error_class(_: &std::num::TryFromIntError) -> &'static str { + "TypeError" +} + pub fn get_error_class_name(e: &AnyError) -> &'static str { deno_runtime::errors::get_error_class_name(e) .or_else(|| { @@ -106,5 +110,9 @@ pub fn get_error_class_name(e: &AnyError) -> &'static str { e.downcast_ref::<ResolutionError>() .map(get_resolution_error_class) }) + .or_else(|| { + e.downcast_ref::<std::num::TryFromIntError>() + .map(get_try_from_int_error_class) + }) .unwrap_or("Error") } |