Return link error instead of assertion failure for bad data initialization

This commit is contained in:
Brandon Fish
2019-08-07 15:40:42 -06:00
parent 180522095f
commit 5d9aa1f986
3 changed files with 32 additions and 9 deletions

View File

@ -80,6 +80,9 @@ pub enum LinkError {
expected: GlobalDescriptor,
found: GlobalDescriptor,
},
Generic {
message: String,
},
}
impl PartialEq for LinkError {
@ -107,6 +110,9 @@ impl std::fmt::Display for LinkError {
LinkError::IncorrectTableDescriptor{namespace, name,expected,found} => {
write!(f, "Incorrect table descriptor, namespace: {}, name: {}, expected table descriptor: {:?}, found table descriptor: {:?}", namespace, name, expected, found)
},
LinkError::Generic { message } => {
write!(f, "{}", message)
},
}
}
}