feat(domain): add DomainError::UniqueViolation {field}
This commit is contained in:
@@ -27,6 +27,9 @@ impl IntoResponse for ApiError {
|
||||
}
|
||||
Self::Domain(DomainError::Forbidden) => (StatusCode::FORBIDDEN, "forbidden".into()),
|
||||
Self::Domain(DomainError::Conflict(m)) => (StatusCode::CONFLICT, m),
|
||||
Self::Domain(DomainError::UniqueViolation { field }) => {
|
||||
(StatusCode::CONFLICT, format!("{field} already taken"))
|
||||
}
|
||||
Self::Domain(DomainError::InvalidInput(m)) => (StatusCode::UNPROCESSABLE_ENTITY, m),
|
||||
Self::Domain(DomainError::ExternalService(_)) => {
|
||||
(StatusCode::BAD_GATEWAY, "external service error".into())
|
||||
|
||||
Reference in New Issue
Block a user