Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions src/error.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
use crate::linking::LinkingError;
use core::fmt;

pub enum Error {
Expand All @@ -14,6 +15,8 @@ pub enum Error {
AuthorIDMismatch,
AppIDMismatch,

Linking(LinkingError),

DecodeMeta(postcard::Error),
DecodeStats(postcard::Error),
SerialEncode(postcard::Error),
Expand Down Expand Up @@ -64,6 +67,7 @@ impl fmt::Display for Error {
Self::ReadFile(name, err) => write!(f, "cannot read {name}: {err}"),
Self::AuthorIDMismatch => write!(f, "author ID in meta and in path don't match"),
Self::AppIDMismatch => write!(f, "app ID in meta and in path don't match"),
Self::Linking(err) => write!(f, "linking: {err}"),
Self::DecodeMeta(err) => write!(f, "cannot decode _meta: {err}"),
Self::DecodeStats(err) => write!(f, "cannot decode stats: {err}"),
Self::SerialEncode(err) => write!(f, "cannot encode response for serial: {err}"),
Expand All @@ -83,6 +87,12 @@ impl From<wasmi::Error> for Error {
}
}

impl From<LinkingError> for Error {
fn from(value: LinkingError) -> Self {
Self::Linking(value)
}
}

/// Runtime stats provided on guest failure that should help to debug the failure cause.
pub struct RuntimeStats {
pub(crate) last_called: &'static str,
Expand Down
Loading