Skip to content

Instantly share code, notes, and snippets.

@jayhuang75
Created September 19, 2022 12:45
Show Gist options
  • Save jayhuang75/0c7f56fe978b69278de5d59aa7edffbb to your computer and use it in GitHub Desktop.
Save jayhuang75/0c7f56fe978b69278de5d59aa7edffbb to your computer and use it in GitHub Desktop.
rust_serverless_trading_view_app_error
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