diff options
author | Nayeem Rahman <nayeemrmn99@gmail.com> | 2021-09-18 14:40:04 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-09-18 15:40:04 +0200 |
commit | 75ca013f076f443dce3d38f31a168295351ed0e5 (patch) | |
tree | a8f369429ff650516a513a0416e8984f457835a4 /cli/ops/errors.rs | |
parent | f840906943849f5a09981e172d57e84301b77386 (diff) |
fix(cli/fmt_errors): Abbreviate long data URLs in stack traces (#12127)
Co-authored-by: Mike White <mike.white@auctane.com>
Diffstat (limited to 'cli/ops/errors.rs')
-rw-r--r-- | cli/ops/errors.rs | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/cli/ops/errors.rs b/cli/ops/errors.rs index 453a9ff6b..a889b1b0d 100644 --- a/cli/ops/errors.rs +++ b/cli/ops/errors.rs @@ -1,6 +1,7 @@ // Copyright 2018-2021 the Deno authors. All rights reserved. MIT license. use crate::diagnostics::Diagnostics; +use crate::fmt_errors::format_file_name; use crate::program_state::ProgramState; use crate::source_maps::get_orig_position; use crate::source_maps::CachedMaps; @@ -16,6 +17,7 @@ use std::sync::Arc; pub fn init(rt: &mut deno_core::JsRuntime) { super::reg_sync(rt, "op_apply_source_map", op_apply_source_map); super::reg_sync(rt, "op_format_diagnostic", op_format_diagnostic); + super::reg_sync(rt, "op_format_file_name", op_format_file_name); } #[derive(Deserialize)] @@ -60,3 +62,11 @@ fn op_format_diagnostic( let diagnostic: Diagnostics = serde_json::from_value(args)?; Ok(json!(diagnostic.to_string())) } + +fn op_format_file_name( + _state: &mut OpState, + file_name: String, + _: (), +) -> Result<String, AnyError> { + Ok(format_file_name(&file_name)) +} |