feat(api_models): add error structs (#532)

Co-authored-by: Sanchith Hegde <22217505+SanchithHegde@users.noreply.github.com>
This commit is contained in:
Nishant Joshi
2023-02-16 14:49:14 +05:30
committed by GitHub
parent 326d6bebe1
commit d107b44fd3
11 changed files with 288 additions and 55 deletions

View File

@ -1,7 +1,7 @@
#![allow(unused_variables)]
use crate::core::errors;
#[derive(Debug, router_derive::ApiError)]
#[derive(Debug, router_derive::ApiError, Clone)]
#[error(error_type_enum = StripeErrorType)]
pub enum StripeErrorCode {
/*
@ -529,3 +529,9 @@ impl From<serde_qs::Error> for StripeErrorCode {
}
}
}
impl common_utils::errors::ErrorSwitch<StripeErrorCode> for errors::ApiErrorResponse {
fn switch(&self) -> StripeErrorCode {
self.clone().into()
}
}