Skip to content
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
1 change: 1 addition & 0 deletions src/frame_buffer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -188,6 +188,7 @@ impl DrawTarget for FrameBuffer {
for y in top_y..bottom_y {
let start_i = y * WIDTH / 2 + start_x / 2;
let end_i = start_i + width / 2;
// TODO: IT PANICS (end_i overflows)
self.data[start_i..end_i].fill(new_byte);
}

Expand Down
Loading