feat(api_event_errors): error field in APIEvents (#2808)

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: harsh-sharma-juspay <125131007+harsh-sharma-juspay@users.noreply.github.com>
This commit is contained in:
ivor-juspay
2023-11-22 12:55:51 +05:30
committed by GitHub
parent c6a5a85748
commit ce10579a72
4 changed files with 23 additions and 4 deletions

View File

@ -1,6 +1,7 @@
use std::borrow::Cow;
use reqwest::StatusCode;
use serde::Serialize;
#[derive(Debug, serde::Serialize)]
pub enum ErrorType {
@ -78,7 +79,8 @@ pub struct Extra {
pub reason: Option<String>,
}
#[derive(Debug, Clone)]
#[derive(Serialize, Debug, Clone)]
#[serde(tag = "type", content = "value")]
pub enum ApiErrorResponse {
Unauthorized(ApiError),
ForbiddenCommonResource(ApiError),
@ -88,7 +90,7 @@ pub enum ApiErrorResponse {
Unprocessable(ApiError),
InternalServerError(ApiError),
NotImplemented(ApiError),
ConnectorError(ApiError, StatusCode),
ConnectorError(ApiError, #[serde(skip_serializing)] StatusCode),
NotFound(ApiError),
MethodNotAllowed(ApiError),
BadRequest(ApiError),