Changes between Initial Version and Version 1 of ExceptionHandler

Dec 6, 2010, 6:27:30 PM (10 years ago)



  • ExceptionHandler

    v1 v1  
     1= The Vespa Exception Hook =
     3When an unhandled exception occurs in Python, Python calls an exception
     4handler. Most apps use Python's default exception handler (which prints
     5the exception to stderr and ends the process) but Python allows one to
     6override the standard exception handler.
     8For technical details on how this works, see the Python standard library
     9documentation for `sys.excepthook` and `sys.__excepthook__`. This document
     10assumes you already understand those details.
     12Each Vespa app sets a custom exception hook early in its initialization.
     13All applications use the same exception hook. As of this writing, our hook is
     15in [browser:/trunk/common/].
     16It does three things --
     18 1. Calls Python's standard exception handler to print the error to stderr.
     19 2. Logs the traceback to a file.
     20 3. Displays a dialog to the user containing the traceback and some info
     21 useful for debugging (info about the machine, Python version, etc.). The
     22 dialog encourages the user to email the info to us and makes it as easy
     23 as possible to do so.
     25== The Exception Dialog ==
     27We really want to encourage users to send us error reports, so we remove
     28as many barriers to that as possible. Ideally the user would just click
     29"Send Error Report", but we weren't able to make things quite that simple.
     31My original version of the dialog invoked the user's local email client and
     32started a new email, but David pointed out that some people user Webmail
     33exclusively and thus don't ''have'' a dedicated local email client. So the
     34dialog has to faciliate copying and pasting into an email.
     36Also, even if the user has local email client, there's limits to what one
     37can do when invoking it programmatically. Without getting into
     38platform-specific scripting (e.g. Applescript), we're limited to what we can
     39stuff into a `mailto:` URL that we pass to Python's ``.
     40One can embed subject, to and even body text in a `mailto:` URL, but one
     41can't specify a file to attach. Furthermore, encoding ~32k characters
     42(the size of a typical bug report) into a URL and expecting it to open
     43correctly in a mail client seems doomed to fail sooner or later. So we
     44ask users to paste it in manually.
     47== Disabling the Exception Handler ==
     49The exception handler is on by default. You can turn it off
     50by adding this to vespa.ini --
     58== The Exception Handler and IDEs ==
     60If you're using an IDE, you might want to disable the exception handler.
     62Brian has reported to me that Vespa's exception handler doesn't play nice
     63with Eclipse-Pydev. I suspect that app tries to set its own exception
     64handler and Vespa's clashes with it. My guess is that other IDEs would
     65exhibit similar behavior.