Exemple #1
0
def endpoint_not_found(e: NotFound) -> Response:
    msg = 'invalid endpoint'
    # The isinstance check is because I am not sure if `e` is always going to
    # be a "NotFound" error here
    if isinstance(e, NotFound):
        msg = e.description
    return api_response(wrap_in_fail_result(msg), HTTPStatus.NOT_FOUND)
Exemple #2
0
 def unhandled_exception(exception: Exception) -> Response:
     """ Flask.errorhandler when an exception wasn't correctly handled """
     log.critical(
         "Unhandled exception when processing endpoint request",
         exc_info=True,
     )
     return api_response(wrap_in_fail_result(str(exception)), HTTPStatus.INTERNAL_SERVER_ERROR)