fix(router/webhooks): map webhook event type not found errors to 422 (#1340)

Co-authored-by: Sampras Lopes <lsampras@protonmail.com>
This commit is contained in:
ItsMeShashank
2023-06-02 16:43:47 +05:30
committed by GitHub
parent 166688a590
commit 61bacd8c95
4 changed files with 17 additions and 7 deletions

View File

@ -64,13 +64,16 @@ impl<T> WebhookApiErrorSwitch<T> for errors::CustomResult<T, errors::ConnectorEr
errors::ConnectorError::WebhookSignatureNotFound
| errors::ConnectorError::WebhookReferenceIdNotFound
| errors::ConnectorError::WebhookEventTypeNotFound
| errors::ConnectorError::WebhookResourceObjectNotFound
| errors::ConnectorError::WebhookBodyDecodingFailed
| errors::ConnectorError::WebhooksNotImplemented => {
Err(e).change_context(errors::ApiErrorResponse::WebhookBadRequest)
}
errors::ConnectorError::WebhookEventTypeNotFound => {
Err(e).change_context(errors::ApiErrorResponse::WebhookUnprocessableEntity)
}
_ => Err(e).change_context(errors::ApiErrorResponse::InternalServerError),
},
}