[Python-ideas] Structured Error Output

Chris Kaynor ckaynor at zindagigames.com
Wed Apr 25 23:46:22 CEST 2012


On Wed, Apr 25, 2012 at 2:33 PM, Terry Reedy <tjreedy at udel.edu> wrote:

> On 4/25/2012 3:27 PM, Bryce Boe wrote:
>
>> 2) an option to provide a structured error output in some common
>> easy-to-parse and extendable format that can be used to associate the
>> file, line number, error type/number in some post-processing error
>> handler. This feature would make the parsing of error messages more
>> deterministic, and would be of significant benefit if other
>> compilers/interpreters also provide the same functionality in the same
>> common format.
>>
>
> Exception instances have a .__traceback__ instance that is used to print
> the default traceback message. So it has or can generate much of what you
> request. I believe traceback objects are documented somewhere. Some apps
> wrap everything in
>
> try: run_app
> except Exception as e: custom_handle(e)


The sys module also has an excepthook (1) which can be overridden to
customize the exception handling. Note that it does not function with the
threading module, however.

(1) http://docs.python.org/library/sys.html#sys.excepthook


>
>
> --
> Terry Jan Reedy
>
>
> ______________________________**_________________
> Python-ideas mailing list
> Python-ideas at python.org
> http://mail.python.org/**mailman/listinfo/python-ideas<http://mail.python.org/mailman/listinfo/python-ideas>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-ideas/attachments/20120425/98b5dcb9/attachment.html>


More information about the Python-ideas mailing list