mirror of
https://github.com/fluencelabs/wasmer
synced 2024-12-13 06:15:33 +00:00
Impl error for link error (#182)
This commit is contained in:
parent
24d028e2a2
commit
6e87676160
@ -76,6 +76,31 @@ impl PartialEq for LinkError {
|
||||
}
|
||||
}
|
||||
|
||||
impl std::fmt::Display for LinkError {
|
||||
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
|
||||
match self {
|
||||
LinkError::ImportNotFound {namespace, name} => write!(f, "Import not found, namespace: {}, name: {}", namespace, name),
|
||||
LinkError::IncorrectGlobalDescriptor {namespace, name,expected,found} => {
|
||||
write!(f, "Incorrect global descriptor, namespace: {}, name: {}, expected global descriptor: {:?}, found global descriptor: {:?}", namespace, name, expected, found)
|
||||
},
|
||||
LinkError::IncorrectImportSignature{namespace, name,expected,found} => {
|
||||
write!(f, "Incorrect import signature, namespace: {}, name: {}, expected signature: {}, found signature: {}", namespace, name, expected, found)
|
||||
}
|
||||
LinkError::IncorrectImportType{namespace, name,expected,found} => {
|
||||
write!(f, "Incorrect import type, namespace: {}, name: {}, expected type: {}, found type: {}", namespace, name, expected, found)
|
||||
}
|
||||
LinkError::IncorrectMemoryDescriptor{namespace, name,expected,found} => {
|
||||
write!(f, "Incorrect memory descriptor, namespace: {}, name: {}, expected memory descriptor: {:?}, found memory descriptor: {:?}", namespace, name, expected, found)
|
||||
},
|
||||
LinkError::IncorrectTableDescriptor{namespace, name,expected,found} => {
|
||||
write!(f, "Incorrect table descriptor, namespace: {}, name: {}, expected table descriptor: {:?}, found table descriptor: {:?}", namespace, name, expected, found)
|
||||
},
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl std::error::Error for LinkError {}
|
||||
|
||||
/// This is the error type returned when calling
|
||||
/// a webassembly function.
|
||||
///
|
||||
|
Loading…
Reference in New Issue
Block a user