[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Error does not throw to debugger in 'when' block
From: |
Arthur Miller |
Subject: |
Re: Error does not throw to debugger in 'when' block |
Date: |
Thu, 12 Jan 2023 23:49:45 +0100 |
User-agent: |
Gnus/5.13 (Gnus v5.13) |
Michael Heerdegen <michael_heerdegen@web.de> writes:
> Arthur Miller <arthur.miller@live.com> writes:
>
>> Michael Heerdegen <michael_heerdegen@web.de> writes:
>>
>> Let's just do the part that matters:
>>
>> > For C-x C-e you need to eval a form that raises an error. Also that
>> > works as expected: evaluating the defun doesn't raise an error as
>> > expected.
>>
>> Yes of course. As Eli said details matters.
>>
>> I have now looked more into it, tested another example, and I do
>> understand now
>> what happeneds; I just didn't know it worked that way:
>>
>> When called interactively with M-x, (as the command) the evaluation of the
>> function exits on error, the error message is emittied, but the
>> evaluation is
>> not trapped in the debugger. When called from lisp, for example via: M-: it
>> ends up in the debugger. I was calling it interactively, and didn't realize
>> realized it worked this way. I wasn't aware that "commands" does not
>> trap in the
>> debugger on errors. Maybe I need to set some other of debug-on-* flags?
>
> Only debug-on-error. That's what I tested. I enabled that option and
> called your command in the original form and got a debugger.
>
> [ Note there is a pitfall: M-: debug-on-error RET prints t although the
> variable's value "is actually" nil - that's because M-: binds the variable
> to t temporarily when evaluating the specified expression. ]
>
Aha :) Now you say something. Yes that seems to be the case. I have checked
Customize now, and that indeed was off. I was always thought I had
debug-on-error to be always on. I obviously didn't. When I checked it's value I
did from within M-:, so that explains it. I should have checked with C-h v
instead or looked in Customize (which I barely ever use). When I have explicitly
set it debug-on-error to 't now it works same even with interactive commands, it
ends in debugger.
What a small thing can take such a long time. If I just checked with C-h v
instead.
I didn't know M-: let-bind the error-on-debug, so thanks for the kind
explanation on that one!
Best regards
/arthur