fix: Replace unwrap with expect for better logging

This commit is contained in:
Jan-Bulthuis committed 2026-04-02 18:18:02 +02:00
1 parent abfdea2e78
commit ea07d11034
2 files changed
+15 -5

No files matched your search

+9 -3
View File
@@ -138,7 +138,10 @@ impl<'a> DocumentWorld<'a> {
}
fn get_package(&self, spec: &PackageSpec) -> PackageResult<PathBuf> {
let path = get_package_path(&VirtualPath::new("").unwrap(), spec);
let path = get_package_path(
&VirtualPath::new("").expect("Failed to create empty virtual path"),
spec,
);
let path = path.realize(&self.context.config.packages_root);
if path.exists() {
@@ -177,6 +180,9 @@ impl<'a> DocumentWorld<'a> {
}
fn get_package_path(file_path: &VirtualPath, spec: &PackageSpec) -> VirtualPath {
let package_path = VirtualPath::new(format!("{}/{}", spec.name, spec.version)).unwrap();
package_path.join(file_path.get_without_slash()).unwrap()
let package_path = VirtualPath::new(format!("{}/{}", spec.name, spec.version))
.expect("Failed to create virtual path representing package path.");
package_path
.join(file_path.get_without_slash())
.expect("Failed to join file path into package path.")
}