1use std::fmt;
2
3pub type Result<T> = std::result::Result<T, SdkError>;
4
5#[derive(Debug)]
6pub struct SdkError(pub String);
7
8impl fmt::Display for SdkError {
9 fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
10 write!(f, "[overdrive-sdk] {}", self.0)
11 }
12}
13
14impl std::error::Error for SdkError {}
15
16impl From<String> for SdkError {
17 fn from(s: String) -> Self { SdkError(s) }
18}
19
20impl From<&str> for SdkError {
21 fn from(s: &str) -> Self { SdkError(s.to_string()) }
22}
23
24impl From<serde_json::Error> for SdkError {
25 fn from(e: serde_json::Error) -> Self { SdkError(e.to_string()) }
26}