Hague Grant Report: Structured Error Messages

No Comments

Moritz has completed his grant and provided the following closing report.

Moritz Lenz writes:

After working for more than a year on my grant on exceptions, I am now confident that I have done all that I have promised, and can now close the grant.

Deliverables

A short summary of what I did for each deliverable follows

D1: Specification

S32::Exception contains my work in this area. It provides information about the basic exception types, the backtrace printer and how they interact with the rest of Perl 6.

There are certainly still open design question in the general space of exceptions like, how do we indicate that an exception should or should not print its backtrace by default? There are ways to achieve this right now, but it's not as easy as it it should be for the end user. However those open questions are well outside the realm of this grant. I still plan to tackle them in due time.

Several approaches to localization and internationalization are now within reach and only wait for somebody to do it.

D2: Error catalog, tests

The error catalog is also in S32::Exception. It is not comprehensive (ie doesn't cover all possible errors that are thrown from current compilers), but the grant request only required an "initial" catalog. It is certainly enough to demonstrate the feasibility of the design, and to handle very many common cases.

Tests are in the roast repository. At the time of writing (2012-06-07) there are 424 tests, of which Rakudo passes nearly all (the few failures are due to known bugs not related to the exception subsystem). I added a utility test function throws_like to Test::Util which makes testing of typed exceptions very easy.

D3: Implementation, tests, documentation

Rakudo now throws only typed exceptions from its setting (with the exception of internal errors). Note that before my work started it only allowed strings as exceptions.

The tests mentioned above already cover several bug reports where people complained about wrong or less-than-awesome error messages. Since my main motivation was to make error testing more robust, I consider this a big success.

Documentation for compiler writers and test authors is available.

Other Exceptions Progress

I'd also like to mention that I did several things related to exceptions which were not covered by this grant:

  • greatly improved backtrace printer
  • Many exceptions from within the compilation process (such as parse errors, redeclarations etc.) are now typed.
  • I enabled typed exceptions thrown from C code, and as a proof of concept I ported all user-visible exceptions in perl6.ops to their intended types.
  • Exceptions from within the meta model can now be caught in the "actions" part of the compiler, augmented with line numbers and file name and re-thrown
  • The Rakudo developers usually only close bug reports when tests are available. I wrote many tests for specific error conditions in response to such bug reports and closed the tickets.

Acknowledgements

I'd like to thank Ian Hague and the Perl Foundation for funding this grant, Karen Pauley and Will Coleda for managing it, and all the people who helped me designing, programming and wording things, especially Jonathan Worthington.

References

Leave a comment

About TPF

The Perl Foundation - supporting the Perl community since 2000. Find out more at www.perlfoundation.org.

About this Entry

This page contains a single entry by Karen published on June 9, 2012 8:20 PM.

Grant Accepted: Improving Cross compilation of Perl 5 was the previous entry in this blog.

Fixing Perl5 Core Bugs: Report for Month 27 is the next entry in this blog.

Find recent content on the main index or look in the archives to find all content.

OpenID accepted here Learn more about OpenID
Powered by Movable Type 4.38