hy/tests
Bob Tolbert f6160c755a Much better version of new error messages.
This version is much simpler.

At the point that the exception is raised, we don't have access to
the actual source, just the current expression. but as the
exception percolates up, we can intercept it, add the source and
the re-raise it.

Then at the final point, in the cmdline handler, we can choose to
let the entire traceback print, or just the simpler, direct error
message.

And even with the full traceback, the last bit is nicely formatted
just like the shorter, simpler message.

The error message is colored if clint is installed, but to avoid
yet another dependency, you get monochrome without clint.

I'm sure there is a better way to do the markup, the current method
is kludgy but works.

I wish there was more shared code between HyTypeError and LexException
but they are kind of different in some fundamental ways.

This doesn't work (yet) with runtime errors generated from Python,
like NameError, but I have a method that can catch NameError and turn it
into a more pleasing output.

Finally, there is no obvious way to raise HyTypeError from pure Hy code,
so methods in core/language.hy throw ugly TypeError/ValueError.
2013-12-31 09:56:03 -07:00
..
compilers Much better version of new error messages. 2013-12-31 09:56:03 -07:00
importer Fix flake error 2013-07-06 20:39:02 +02:00
lex Hy reader macros #377 2013-12-23 14:33:51 +01:00
macros Hy reader macros #377 2013-12-23 14:33:51 +01:00
models Make HyList add returns HyList 2013-04-28 17:04:33 +02:00
native_tests Merge branch 'master' into pr/363 2013-12-31 11:41:30 -05:00
resources Rewrite the bootstrap macros in hy 2013-09-29 18:13:28 +02:00
__init__.py added for and with macros 2013-12-29 16:50:21 +01:00
test_bin.py Much better version of new error messages. 2013-12-31 09:56:03 -07:00