Handle errors raised by plugins more gracefully in mod_wsgi.

This started as an effort to display a more useful error message in the
Apache error log if retrieving the schema failed. I broadened the scope
a little to include limiting the output in the Apache error log
so errors are easier to find.

This adds a new configuration option, startup_traceback. Outside of
lite-server.py it is False by default so does not display the traceback
that lead to the StandardError being raised. This makes the mod_wsgi
error much easier to follow.
This commit is contained in:
Rob Crittenden
2010-06-25 13:37:27 -04:00
parent 7f9485f5bf
commit ccaf537aa6
6 changed files with 36 additions and 22 deletions

View File

@@ -536,8 +536,9 @@ class API(DictProxy):
'skipping plugin module %s: %s', fullname, e.reason
)
except StandardError, e:
import traceback
self.log.error('could not load plugin module %r\n%s', pyfile, traceback.format_exc())
if self.env.startup_traceback:
import traceback
self.log.error('could not load plugin module %r\n%s', pyfile, traceback.format_exc())
raise e
def finalize(self):