Skip to main content

shilp_sdk/
error.rs

1use thiserror::Error;
2
3#[derive(Error, Debug)]
4pub enum ShilpError {
5    #[error("HTTP request failed: {0}")]
6    RequestFailed(#[from] reqwest::Error),
7
8    #[error("API error: {message} (status: {status})")]
9    ApiError { message: String, status: u16 },
10
11    #[error("Invalid URL: {0}")]
12    InvalidUrl(String),
13
14    #[error("Failed to serialize request body: {0}")]
15    SerializationError(#[from] serde_json::Error),
16
17    #[error("IO error: {0}")]
18    IoError(#[from] std::io::Error),
19
20    #[error("Validation error: {0}")]
21    ValidationError(String),
22}
23
24pub type Result<T> = std::result::Result<T, ShilpError>;