[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Any downside to condition-case-unless-debug?
From: |
Eric Abrahamsen |
Subject: |
Re: Any downside to condition-case-unless-debug? |
Date: |
Thu, 27 May 2021 19:02:30 -0700 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux) |
Stefan Monnier <monnier@iro.umontreal.ca> writes:
>> I feel like a lot of my debugging recently has involved various ways of
>> working around `condition-case' and its swallowing of useful error
>> information. Is there any reason not to prefer
>> `condition-case-unless-debug' in new code?
>
> IME, `condition-case-unless-debug' is used/useful mostly for
> `condition-case` that catch "any error", most of which might be better
> served by something like `with-demoted-errors`.
>
> For those `condition-case` which catch one particular kind of error to
> handle a particular expected situation (e.g. when catching `scan-error`
> around a call to `forward-sexp`), `condition-case-unless-debug` rarely
> makes sense.
Yes, exactly! The cases I'm looking at are all cases that catch "any
error", often for no good reason (IMO). I'll try to tend towards patches
that remove `condition-case' altogether, rather than
`condition-case-unless-debug'.