summaryrefslogtreecommitdiff
path: root/cli/fmt_errors.rs
diff options
context:
space:
mode:
authorNayeem Rahman <nayeemrmn99@gmail.com>2022-04-19 09:59:51 +0100
committerGitHub <noreply@github.com>2022-04-19 10:59:51 +0200
commitc30d95f2e36cb3519e1e23c0934b388ebba6bc2c (patch)
treef34db42cce4803e76affb12ccb95ad59a77354ad /cli/fmt_errors.rs
parenta64e63c3614b98aa2b51fb6b7ef4e30251e03111 (diff)
feat(ext/web): add globalThis.reportError() (#13799)
Diffstat (limited to 'cli/fmt_errors.rs')
-rw-r--r--cli/fmt_errors.rs5
1 files changed, 3 insertions, 2 deletions
diff --git a/cli/fmt_errors.rs b/cli/fmt_errors.rs
index 953dfec8b..3016e0ff4 100644
--- a/cli/fmt_errors.rs
+++ b/cli/fmt_errors.rs
@@ -48,8 +48,9 @@ pub fn format_location(frame: &JsStackFrame) -> String {
return cyan("native").to_string();
}
let mut result = String::new();
- if let Some(file_name) = &frame.file_name {
- result += &cyan(&format_file_name(file_name)).to_string();
+ let file_name = frame.file_name.clone().unwrap_or_default();
+ if !file_name.is_empty() {
+ result += &cyan(&format_file_name(&file_name)).to_string();
} else {
if frame.is_eval {
result +=