Skip to content

Commit

Permalink
Handle WS exception
Browse files Browse the repository at this point in the history
  • Loading branch information
kalaspuff committed Mar 2, 2018
1 parent 0b053a2 commit 1b4f627
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions tomodachi/transport/http.py
Original file line number Diff line number Diff line change
Expand Up @@ -432,9 +432,12 @@ async def _func(obj: Any, request: web.Request) -> None:
if not context.get('log_level') or context.get('log_level') in ['DEBUG']:
traceback.print_exception(e.__class__, e, e.__traceback__)
elif message.type == WSMsgType.ERROR:
e = ws.exception()
if not context.get('log_level') or context.get('log_level') in ['DEBUG']:
traceback.print_exception(e.__class__, e, e.__traceback__)
ws_exception = websocket.exception()
if isinstance(ws_exception, Exception):
traceback.print_exception(ws_exception.__class__, ws_exception, ws_exception.__traceback__)
else:
logging.getLogger('transport.http').warning('Websocket exception: "{}"'.format(ws_exception))
elif message.type == WSMsgType.CLOSED:
break # noqa
finally:
Expand Down

0 comments on commit 1b4f627

Please sign in to comment.