dpallot / simple-websocket-server

A python based websocket server that is simple and easy to use.
950 stars 320 forks source link

Meaningful output on exception #76

Open daylanKifky opened 6 years ago

daylanKifky commented 6 years ago

Would it be possible to get a backtrace or something when an exception is raised from some of the handlers? At the moment the server just closes the connection silently. Perhaps just as an optional debugging flag?

SupraSummus commented 6 years ago

simple workaround:

import logging

def handleMessage(self):
    try:
        do_things()

    except:
        logging.exception('error during handling user data')
        self.close(status=1011, reason='Internal server error')
dpallot commented 5 years ago

Seams reasonable to me, ill look at it.

benjamingorman commented 5 years ago

Any progress on this? @dpallot Might you accept a PR to implement this? It took me a while to realize that the library was silently discarding exceptions from the handlers - this really shouldn't be the default behaviour.