(&self)
| 18 | // impl ResponseError trait allows to convert our errors into http responses with appropriate data |
| 19 | impl ResponseError for ServiceError { |
| 20 | fn error_response(&self) -> HttpResponse { |
| 21 | match self { |
| 22 | ServiceError::InternalServerError => { |
| 23 | HttpResponse::InternalServerError().json("Internal Server Error, Please try later") |
| 24 | } |
| 25 | ServiceError::BadRequest(message) => HttpResponse::BadRequest().json(message), |
| 26 | ServiceError::Unauthorized => HttpResponse::Unauthorized().json("Unauthorized"), |
| 27 | } |
| 28 | } |
| 29 | } |
| 30 | |
| 31 | // we can return early in our handlers if UUID provided by the user is not valid |
nothing calls this directly
no outgoing calls
no test coverage detected