use thiserror::Error;

/// Convenient result type used by the Shelly runtime.
pub type LiveResult<T = ()> = Result<T, ShellyError>;

/// Errors returned by the Shelly core runtime.
#[derive(Debug, Error, PartialEq, Eq)]
pub enum ShellyError {
    /// A received client message did not match the expected protocol shape.
    #[error("invalid client message: {0}")]
    InvalidMessage(String),

    /// A LiveView returned a rendering error.
    #[error("render error: {0}")]
    Render(String),

    /// A LiveView failed while handling an event.
    #[error("event error: {0}")]
    Event(String),
}
