(errors: Any, status_code: HTTPStatus)
| 36 | |
| 37 | |
| 38 | def api_error(errors: Any, status_code: HTTPStatus) -> Response: |
| 39 | assert status_code in ERROR_STATUS_CODES, "Programming error, unexpected error status code" |
| 40 | log.error("Error processing request", errors=errors, status_code=status_code) |
| 41 | response = make_response( |
| 42 | ( |
| 43 | json.dumps(dict(errors=errors)), |
| 44 | status_code, |
| 45 | {"mimetype": "application/json", "Content-Type": "application/json"}, |
| 46 | ) |
| 47 | ) |
| 48 | return response |
| 49 | |
| 50 | |
| 51 | def if_api_available(method: Callable) -> Callable: |
no test coverage detected