Implement Error for Trap (#73)

This commit is contained in:
Sergey Pepyakin 2018-03-12 12:37:12 +01:00 committed by GitHub
parent 7c88c6ad65
commit 0c277abacb
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 12 additions and 0 deletions

View File

@ -134,6 +134,18 @@ impl Trap {
} }
} }
impl fmt::Display for Trap {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "Trap: {:?}", self.kind)
}
}
impl error::Error for Trap {
fn description(&self) -> &str {
"runtime trap"
}
}
/// Error type which can thrown by wasm code or by host environment. /// Error type which can thrown by wasm code or by host environment.
/// ///
/// See [`Trap`] for details. /// See [`Trap`] for details.