from sqlalchemy import exc as sqlalchemyExc see https://github.com/lsst/qserv/blob/tickets/DM-2558/core/modules/wmgr/python/dbMgr.py On 09/09/2015 10:27 AM, Van Klaveren, Brian N. wrote: > What is sqlalchemyExc? > > Brian > > >> On Sep 9, 2015, at 9:49 AM, Becla, Jacek <[log in to unmask]> wrote: >> >> Andy (and Brian?) >> >> I don't know if that can easily be improved... Here is what I typically get when I introduce a problem in wmgr: >> >> Traceback (most recent call last): >> File "/home/becla/stack/Linux64/flask/0.10.1+11/lib/python/Flask-0.10.1-py2.7.egg/flask/app.py", line 1817, in wsgi_app >> response = self.full_dispatch_request() >> File "/home/becla/stack/Linux64/flask/0.10.1+11/lib/python/Flask-0.10.1-py2.7.egg/flask/app.py", line 1477, in full_dispatch_request >> rv = self.handle_user_exception(e) >> File "/home/becla/stack/Linux64/flask/0.10.1+11/lib/python/Flask-0.10.1-py2.7.egg/flask/app.py", line 1378, in handle_user_exception >> if isinstance(e, typecheck): >> TypeError: isinstance() arg 2 must be a class, type, or tuple of classes and types >> 2015-09-09 11:37:43,574 [PID:4849] [INFO] (_log() at _internal.py:87) werkzeug: 127.0.0.1 - - [09/Sep/2015 11:37:43] "POST /dbs HTTP/1.1" 500 - >> >> >> to get a sensible stack trace that is actually useful, I end up >> commenting out: >> >> [log in to unmask](DbException) >> [log in to unmask](sqlalchemyExc) >> [log in to unmask](MySQLdb.Error) >> [log in to unmask](MySQLdb.Warning) >> #def dbExceptionHandler(error): >> # """ All leaked database-related exceptions generate 500 error """ >> # return errorResponse(500, error.__class__.__name__, str(error)) >> >> >> This is the error I would get if errorhandler code would be >> commented out: >> >> >> Traceback (most recent call last): >> File "/home/becla/stack/Linux64/flask/0.10.1+11/lib/python/Flask-0.10.1-py2.7.egg/flask/app.py", line 1817, in wsgi_app >> response = self.full_dispatch_request() >> File "/home/becla/stack/Linux64/flask/0.10.1+11/lib/python/Flask-0.10.1-py2.7.egg/flask/app.py", line 1477, in full_dispatch_request >> rv = self.handle_user_exception(e) >> File "/home/becla/stack/Linux64/flask/0.10.1+11/lib/python/Flask-0.10.1-py2.7.egg/flask/app.py", line 1381, in handle_user_exception >> reraise(exc_type, exc_value, tb) >> File "/home/becla/stack/Linux64/flask/0.10.1+11/lib/python/Flask-0.10.1-py2.7.egg/flask/app.py", line 1475, in full_dispatch_request >> rv = self.dispatch_request() >> File "/home/becla/stack/Linux64/flask/0.10.1+11/lib/python/Flask-0.10.1-py2.7.egg/flask/app.py", line 1461, in dispatch_request >> return self.view_functions[rule.endpoint](**req.view_args) >> File "/usr/local/home/becla/stack/repos/qserv/lib/python/lsst/qserv/wmgr/dbMgr.py", line 194, in createDb >> dbConn = Config.instance().privDbEngine().connect() >> File "/usr/local/home/becla/stack/repos/qserv/lib/python/lsst/qserv/wmgr/config.py", line 120, in privDbEngine >> inst = engineFactory().getEngineFromArgs(**kwargs) >> NameError: global name 'engineFactory' is not defined >> >> >> See? That is so much better. I entered engineFactory instead of >> EngineFactory. There is no way I could have figured it out from the >> previous stack trace... >> >> How can we improve that? >> >> Jacek > ######################################################################## Use REPLY-ALL to reply to list To unsubscribe from the QSERV-L list, click the following link: https://listserv.slac.stanford.edu/cgi-bin/wa?SUBED1=QSERV-L&A=1