fauna-api 1.0.856

The Fauna SDK for Rust: accounts, Drive, groups, calendar, chats, payments, Parrot and live rooms.
Documentation
use thiserror::Error as ThisError;

/// Every fallible SDK call returns this. `Http` carries the response body the
/// TypeScript SDK throws as `new Error(await response.text())`.
#[derive(Debug, ThisError)]
pub enum Error {
    #[error("{body}")]
    Http { status: u16, body: String },
    #[error("{0}")]
    Message(String),
    #[error(transparent)]
    Request(#[from] reqwest::Error),
    #[error(transparent)]
    Json(#[from] serde_json::Error),
    #[error(transparent)]
    WebSocket(#[from] Box<tokio_tungstenite::tungstenite::Error>),
    /// A push to a dataset where no row was let through: why, and each row's reason.
    #[error("{}", .0.message)]
    PushRefused(crate::marmot::research::PushRefused),
}

impl From<tokio_tungstenite::tungstenite::Error> for Error {
    fn from(error: tokio_tungstenite::tungstenite::Error) -> Self {
        Error::WebSocket(Box::new(error))
    }
}

pub type Result<T> = std::result::Result<T, Error>;