1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
use std::error::Error;
use std::fmt::{Display, Formatter};

#[derive(Debug, Clone)]

/// An error returned by a struct in the SDK.
pub struct SDKError {
    pub code: Option<u16>,
    pub detail: Option<String>,
}

impl Display for SDKError {
    fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result {
        write!(
            f,
            "SDK Error: ErrorCode: {:?}\nDetails: {:?}",
            self.code, self.detail
        )
    }
}

impl Error for SDKError {}