GNU bug report logs - #11218
with-demoted-errors use of condition-case-unless-debug; ert

Previous Next

Package: emacs;

Reported by: Glenn Morris <rgm <at> gnu.org>

Date: Wed, 11 Apr 2012 03:39:01 UTC

Severity: normal

Tags: fixed

Found in version 24.0.95

Done: Eli Zaretskii <eliz <at> gnu.org>

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: help-debbugs <at> gnu.org (GNU bug Tracking System)
To: Glenn Morris <rgm <at> gnu.org>
Subject: bug#11218: closed (Re: bug#11218: with-demoted-errors use of
 condition-case-unless-debug; ert)
Date: Sun, 09 Mar 2025 08:40:02 +0000
[Message part 1 (text/plain, inline)]
Your bug report

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

which was filed against the emacs package, has been closed.

The explanation is attached below, along with your original report.
If you require more details, please reply to 11218 <at> debbugs.gnu.org.

-- 
11218: https://debbugs.gnu.org/cgi/bugreport.cgi?bug=11218
GNU Bug Tracking System
Contact help-debbugs <at> gnu.org with problems
[Message part 2 (message/rfc822, inline)]
From: Eli Zaretskii <eliz <at> gnu.org>
To: p.stephani2 <at> gmail.com, 11218-done <at> debbugs.gnu.org, ohler <at> gnu.org,
 npostavs <at> gmail.com, monnier <at> iro.umontreal.ca
Subject: Re: bug#11218: with-demoted-errors use of condition-case-unless-debug; ert
Date: Sun, 09 Mar 2025 10:38:55 +0200
> Cc: 11218 <at> debbugs.gnu.org, ohler <at> gnu.org, npostavs <at> gmail.com,
>  monnier <at> iro.umontreal.ca
> Date: Fri, 21 Feb 2025 09:01:09 +0200
> From: Eli Zaretskii <eliz <at> gnu.org>
> 
> > Cc: 11218 <at> debbugs.gnu.org, Stefan Monnier <monnier <at> iro.umontreal.ca>,
> >  Christian Ohler <ohler <at> gnu.org>
> > From: Philipp Stephani <p.stephani2 <at> gmail.com>
> > Date: Thu, 20 Feb 2025 21:31:57 +0100
> > 
> > 
> > 
> > > Am 24.11.2020 um 18:34 schrieb Philipp Stephani <p.stephani2 <at> gmail.com>:
> > > 
> > > Am Mi., 15. Aug. 2018 um 03:11 Uhr schrieb Noam Postavsky <npostavs <at> gmail.com>:
> > >> 
> > >> Christian Ohler <ohler <at> gnu.org> writes:
> > >> 
> > >>> On 4/13/12 6:44 AM, Stefan Monnier wrote:
> > >>>>>>> If you replace with-demoted-errors with ignore-errors, the test passes.
> > >>>>>> Looks like a bug in ERT.
> > >>>>> I don't know if it's a "bug" per se...
> > >>>>> ert--run-test-internal binds debug-on-error to t, and redefines the
> > >>>>> debugger to ert--run-test-debugger. As the doc of that function says:
> > >>>> 
> > >>>> I wonder why ERT doesn't just use condition-case to catch and record
> > >>>> the errors.
> > >>> 
> > >>> Two reasons that I remember off the top of my head: Recording
> > >>> backtraces, and recording additional information provided with
> > >>> `ert-info'.  Using condition-case would let ERT regain control only
> > >>> after the stack is unwound, at which point that information is gone.
> > >> 
> > >> I just posted a patch which changes ERT to use `signal-hook-function' to
> > >> record backtraces instead.  It fixes the case in the OP.
> > >> 
> > >> https://debbugs.gnu.org/cgi/bugreport.cgi?bug=30745#20
> > >> 
> > >> Note that condition-case also needs an enhancement to be able to catch
> > >> any signal (Bug#24618), so that might be a third reason why ERT didn't
> > >> go this route originally.
> > >> 
> > > 
> > > This issue continues to bug me because normal and expected use of
> > > with-demoted-errors in (unrelated) libraries breaks tests in annoying
> > > ways. Is there any way I can help move this forward? Is your patch
> > > still blocked on anything?
> > 
> > This has probably been fixed by commit fe0f15dbc962b37d98507a494fd7720bad584a7a.
> 
> Thanks, but what does "probably" mean in this case?  Can we close the
> bug, or is there anything left to do here?

No further comments, so I presume the bug was fixed, and I'm therefore
closing it.

[Message part 3 (message/rfc822, inline)]
From: Glenn Morris <rgm <at> gnu.org>
To: submit <at> debbugs.gnu.org
Subject: with-demoted-errors use of condition-case-unless-debug; ert
Date: Tue, 10 Apr 2012 23:37:03 -0400
Package: emacs
Version: 24.0.95

with-demoted-errors use of condition-case-unless-debug is annoying.
If I want to debug a condition-case, I'll set debug-on-signal non-nil.
As it stands, with-demoted-errors is not useful if you want to write an
ERT test (for reasons I haven't investigated).

(defun foo ()
  (with-demoted-errors (error "error!"))
  t)

(ert-deftest test-foo ()
  "Test foo"
  (should (foo)))

M-x ert RET test-foo RET

Selector: test-foo
Passed: 0
Failed: 1 (1 unexpected)
Total:  1/1


If you replace with-demoted-errors with ignore-errors, the test passes.



This bug report was last modified 167 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.