Skip to content

Commit 40d5e8f

Browse files
committed
Improve name of locate module error
1 parent b42b1d1 commit 40d5e8f

File tree

1 file changed

+11
-10
lines changed

1 file changed

+11
-10
lines changed

lib/wasix/src/state/linker.rs

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -472,7 +472,7 @@ pub enum LinkError {
472472
TableAllocationError(RuntimeError),
473473

474474
#[error("Failed to find shared library {0}: {1}")]
475-
SharedLibraryMissing(String, FsErrors),
475+
SharedLibraryMissing(String, LocateModuleError),
476476

477477
#[error("Module is not a dynamic library")]
478478
NotDynamicLibrary,
@@ -520,15 +520,16 @@ pub enum LinkError {
520520
}
521521

522522
#[derive(Debug)]
523-
pub enum FsErrors {
524-
SingleError(FsError),
525-
MultipleErrors(Vec<(PathBuf, FsError)>),
523+
pub enum LocateModuleError {
524+
Single(FsError),
525+
Multiple(Vec<(PathBuf, FsError)>),
526526
}
527-
impl std::fmt::Display for FsErrors {
527+
528+
impl std::fmt::Display for LocateModuleError {
528529
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
529530
match self {
530-
FsErrors::SingleError(e) => std::fmt::Display::fmt(&e, f),
531-
FsErrors::MultipleErrors(errors) => {
531+
LocateModuleError::Single(e) => std::fmt::Display::fmt(&e, f),
532+
LocateModuleError::Multiple(errors) => {
532533
for (path, error) in errors {
533534
write!(f, "\n {}: {}", path.display(), error)?;
534535
}
@@ -3588,7 +3589,7 @@ async fn locate_module(
35883589
try_load(&fs.root_fs, module_path).await.map_err(|e| {
35893590
LinkError::SharedLibraryMissing(
35903591
module_path.to_string_lossy().into_owned(),
3591-
FsErrors::SingleError(e),
3592+
LocateModuleError::Single(e),
35923593
)
35933594
})
35943595
} else if module_path.components().count() > 1 {
@@ -3601,7 +3602,7 @@ async fn locate_module(
36013602
.map_err(|e| {
36023603
LinkError::SharedLibraryMissing(
36033604
module_path.to_string_lossy().into_owned(),
3604-
FsErrors::SingleError(e),
3605+
LocateModuleError::Single(e),
36053606
)
36063607
})
36073608
} else {
@@ -3637,7 +3638,7 @@ async fn locate_module(
36373638
trace!(?module_path, "Failed to locate module");
36383639
Err(LinkError::SharedLibraryMissing(
36393640
module_path.to_string_lossy().into_owned(),
3640-
FsErrors::MultipleErrors(errors),
3641+
LocateModuleError::Multiple(errors),
36413642
))
36423643
}
36433644
}

0 commit comments

Comments
 (0)