safe_vk/util/
error.rs

1use crate::Shape;
2use reqwest::Error as ReqwestError;
3use serde_json::Error as SerdeJsonError;
4
5#[derive(thiserror::Error, Debug)]
6pub enum Error {
7    #[error("Dimension index {dim} exceeds the maximum allowed shape dimensions (5x10) for shape {shape:?}")]
8    DimOutOfRange { shape: Shape, dim: i32 },
9
10    #[error("Expected status success (1) but got uknown status {status}")]
11    EventAnswerUnkownStatus { status: i8 },
12
13    #[error("Expected some content but got nothing in {from}")]
14    NoContent { from: &'static str },
15
16    #[error("Serde JSON error: {0}")]
17    SerdeJson(#[from] SerdeJsonError),
18
19    #[error("Reqwest error: {0}")]
20    Reqwest(#[from] ReqwestError),
21}
22
23pub type Result<T> = std::result::Result<T, Error>;