Skip to content

Commit

Permalink
add logger to help debug travis
Browse files Browse the repository at this point in the history
  • Loading branch information
cognifloyd committed May 24, 2019
1 parent e5833eb commit 561e467
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion connexion/apis/aiohttp_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,19 +60,23 @@ def problems_middleware(request, handler):
try:
response = yield from handler(request)
except ProblemException as exc:
logger.debug('ProblemException', exc_info=exc)
response = exc.to_problem()
except (werkzeug_HTTPException, _HttpNotFoundError) as exc:
logger.debug('problem from werkzeug', exc_info=exc)
response = problem(status=exc.code, title=exc.name, detail=exc.description)
except web.HTTPError as exc:
if exc.text == "{}: {}".format(exc.status, exc.reason):
detail = HTTPStatus(exc.status).description
else:
detail = exc.text
logger.debug('problem from web.HTTPError', exc_info=exc)
response = problem(status=exc.status, title=exc.reason, detail=detail)
except (
web.HTTPException, # eg raised HTTPRedirection or HTTPSuccessful
asyncio.CancelledError, # skipped in default web_protocol
):
) as exc:
logger.debug('re-raising exception', exc_info=exc)
# leave this to default handling in aiohttp.web_protocol.RequestHandler.start()
raise
except asyncio.TimeoutError as exc:
Expand All @@ -84,6 +88,9 @@ def problems_middleware(request, handler):
logger.exception('Error handling request', exc_info=exc)
response = _generic_problem(HTTPStatus.INTERNAL_SERVER_ERROR, exc)

if isinstance(response, ProblemException):
logger.exception('response is a ProblemException', exc_info=response)

if isinstance(response, ConnexionResponse):
response = yield from AioHttpApi.get_response(response)
return response
Expand Down

0 comments on commit 561e467

Please sign in to comment.