quetz-mod_python-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Graham Dumpleton" <grah...@dscpl.com.au>
Subject Changes to what is displayed when handler exception occurs.
Date Tue, 24 Oct 2006 04:02:07 GMT
I've just checked in a lot of code related to:

  http://issues.apache.org/jira/browse/MODPYTHON-193
  http://issues.apache.org/jira/browse/MODPYTHON-196

At the same time I have done this, I have played a bit with the format of what
is displayed back to the browser and in the error log files when an unexpected
exception (internal server error) occurs in a handler.

For example, in the browser one might see:

  MOD_PYTHON ERROR

  PID: 8732
  Interpreter: 'application'
  Phase: 'PythonHeaderParserHandler'

  URI: '/~grahamd/handlers/index.html'
  Location: None
  Directory: '/Users/grahamd/public_html/handlers/'
  Filename: '/Users/grahamd/public_html/handlers/index.html'
  PathInfo: ''

  Handler: './_handlers/dispatch.py'

  Traceback (most recent call last):

    File "/System/Library/Frameworks/Python.framework/Versions/2.3/lib/python2.3/site-packages/mod_python/importer.py",
line 1494, in HandlerDispatch
      default=default_handler, arg=req, silent=hlist.silent)

    File "/System/Library/Frameworks/Python.framework/Versions/2.3/lib/python2.3/site-packages/mod_python/importer.py",
line 1199, in _process_target
      result = _execute_target(config, req, object, arg)

    File "/System/Library/Frameworks/Python.framework/Versions/2.3/lib/python2.3/site-packages/mod_python/importer.py",
line 1098, in _execute_target
      result = object(arg)

    File "/Users/grahamd/public_html/handlers/_handlers/dispatch.py", line 10, in headerparserhandler
      xxx

  NameError: global name 'xxx' is not defined

Although not formatted quite the same, the additional information is similarly
output to the Apache error log file.

The idea is to include at least a bit more basic information which may be of
use in tracking down problems, but not to go overboard.

I know we have talked a bit before about providing a means of allowing people
to return custom error pages and I haven't forgotten that. The cleanup of the
code and working out what the report error function should take in the way of
arguments is a first step to seeing how the ability to override it could be
done.

Anyway, comments most welcome. Is there any other basic information that
should perhaps be included in such a page. For example, the name of server
or virtual host etc. I don't want to include stuff which is too obvious though.

BTW, you may note one of the fields being output is Location. If the handler
is used within a Location directive, this should be the matched value of the
Location directive. There hasn't previously been any way of determining this
before, but MODPYTHON-193 now provides a way.  If anyone is using the
Location directive, would be interested in feedback indicating that this is
always yielding the expected result.

Graham



Mime
View raw message