solo_lib/error.rs
1//! # Error types for the Solo SDK
2//!
3//! This module provides a unified error handling mechanism for cloud service providers.
4//! It standardizes error responses from different cloud vendors into a consistent format,
5//! making it easier to handle errors across different cloud platforms.
6
7use std::fmt::Display;
8
9use serde::{Deserialize, Serialize};
10use thiserror::Error;
11
12/// Error type for the Solo SDK
13#[derive(Debug, Clone, Serialize, Deserialize, Error)]
14pub struct SdkError {
15 /// Request ID
16 pub request_id: String,
17 /// Error code
18 pub code: String,
19 /// Error message
20 pub message: String,
21}
22
23impl Display for SdkError {
24 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
25 write!(
26 f,
27 "SdkError: request_id={}, code={}, message={}",
28 self.request_id, self.code, self.message
29 )
30 }
31}