Created
September 19, 2022 12:45
-
-
Save jayhuang75/0c7f56fe978b69278de5d59aa7edffbb to your computer and use it in GitHub Desktop.
rust_serverless_trading_view_app_error
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
pub enum AppErrorType { | |
SerdeJsonError, | |
ReqwestError, | |
AwsSdkError, | |
DbError | |
} | |
#[derive(Debug, PartialEq)] | |
pub struct AppError { | |
pub message: Option<String>, | |
pub cause: Option<String>, | |
pub error_type: AppErrorType, | |
} | |
impl From<serde_json::Error> for AppError { | |
fn from(error: serde_json::Error) -> AppError { | |
AppError { | |
message: Some(error.to_string()), | |
cause: Some("serde_json error".to_string()), | |
error_type: AppErrorType::SerdeJsonError, | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment