From 18c9a7ad641302a9f5e0ccb07da732890f8e0505 Mon Sep 17 00:00:00 2001 From: Divy Srivastava Date: Sat, 25 Jun 2022 09:21:58 +0530 Subject: fix(core): don't panic on non-existent cwd (#14957) Co-authored-by: cjihrig --- core/module_specifier.rs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'core') diff --git a/core/module_specifier.rs b/core/module_specifier.rs index ecdebbd74..3f329f53f 100644 --- a/core/module_specifier.rs +++ b/core/module_specifier.rs @@ -138,7 +138,9 @@ pub fn resolve_url_or_path( pub fn resolve_path( path_str: &str, ) -> Result { - let path = current_dir().unwrap().join(path_str); + let path = current_dir() + .map_err(|_| ModuleResolutionError::InvalidPath(path_str.into()))? + .join(path_str); let path = normalize_path(&path); Url::from_file_path(path.clone()) .map_err(|()| ModuleResolutionError::InvalidPath(path)) -- cgit v1.2.3