mirror of
https://github.com/fluencelabs/interface-types
synced 2024-12-04 15:20:20 +00:00
feat(interface-types) Implement Error
on errors.
This commit is contained in:
parent
c41979400e
commit
43fb922de8
@ -3,6 +3,7 @@
|
||||
|
||||
use crate::{ast::InterfaceType, interpreter::Instruction};
|
||||
use std::{
|
||||
error::Error,
|
||||
fmt::{self, Display, Formatter},
|
||||
result::Result,
|
||||
string::{self, ToString},
|
||||
@ -28,6 +29,14 @@ pub struct WasmValueNativeCastError {
|
||||
pub to: InterfaceType,
|
||||
}
|
||||
|
||||
impl Error for WasmValueNativeCastError {}
|
||||
|
||||
impl Display for WasmValueNativeCastError {
|
||||
fn fmt(&self, formatter: &mut Formatter) -> fmt::Result {
|
||||
write!(formatter, "{:?}", self)
|
||||
}
|
||||
}
|
||||
|
||||
/// Structure to represent the errors for instructions.
|
||||
#[derive(Debug)]
|
||||
pub struct InstructionError {
|
||||
@ -47,6 +56,8 @@ impl InstructionError {
|
||||
}
|
||||
}
|
||||
|
||||
impl Error for InstructionError {}
|
||||
|
||||
impl Display for InstructionError {
|
||||
fn fmt(&self, formatter: &mut Formatter) -> fmt::Result {
|
||||
write!(
|
||||
@ -140,6 +151,8 @@ pub enum InstructionErrorKind {
|
||||
String(string::FromUtf8Error),
|
||||
}
|
||||
|
||||
impl Error for InstructionErrorKind {}
|
||||
|
||||
impl Display for InstructionErrorKind {
|
||||
fn fmt(&self, formatter: &mut Formatter) -> fmt::Result {
|
||||
match self {
|
||||
|
Loading…
Reference in New Issue
Block a user