bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#11218: with-demoted-errors use of condition-case-unless-debug; ert


From: Stefan Monnier
Subject: bug#11218: with-demoted-errors use of condition-case-unless-debug; ert
Date: Fri, 20 Apr 2012 08:13:25 -0400
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.1.50 (gnu/linux)

>> So the next question is: why does ERT record a backtrace and that extra
>> information provided by ert-info?
> To be able to show them to the user, together with the test failure.  If you
> have one or more failing tests, it's much more useful to see the error
> messages and backtraces rather than just the error messages.

I don't see the point of showing that info when running the tests.
If the user wants that info, he should be able to easily say "run this
test with debug-on-error" so he doesn't only get a backtrace but also
gets put in the debugger where he can inspect the state.

>   (ert-deftest foo ()
>     (with-demoted-errors (error "a"))
>     (error "b"))

> would normally fail with "b", but if we enable debugging to track down why,
> it will fail with "a" instead (with no way to continue execution to get to
> the error we are interested in).

No: you'll be put in the debugger for the error "a" but if you hit `c'
it will continue and re-enter the debugger for error "b".

> Fundamentally, having conditionals in the code that explicitly check
> debug-on-error' seems like asking for trouble.

I agree it's not something we should do in general, but
with-demoted-error was designed largely for the specific case where
errors should not happen (i.e. if one happens, we want to be able to
debug it easily by setting debug-on-error), but at the same time you
know very well how the program should respond in case of an unexpected
error (so the user who's not in a position to fix the bug can get his
job done).


        Stefan





reply via email to

[Prev in Thread] Current Thread [Next in Thread]