Subject: Re: [bug#50814] [PATCH] guix: git-authenticate: Also authenticate the channel intro commit.

From: Maxime Devos <[email-masked]>
Date: Tue, 28 Sep 2021 12:02:23 +0200

Attila Lendvai schreef op ma 27-09-2021 om 18:45 [+0000]:
[...]
> using `(warning ...)` will just print something to stderr.
> 
> i was hoping to raise a continuable condition of type &warning, that i can even check for in the tests,
> but i have failed to put that together. the scheme/guile condition system is a bit messy/convoluted.

Technically, Scheme supports continuable exceptions with 'raise-continuable'
and with-exception-hander.  E.g., the following Racket example:

 (use-modules (rnrs exceptions) (rnrs conditions))
 (with-exception-handler
  (lambda (con)
    (cond
      ((not (warning? con))
       (raise con))
      ((message-condition? con)
       (display (condition-message con)))
      (else
       (display "a warning has been issued")))
    42)
  (lambda ()
    (+ (raise-continuable
         (condition
           (make-warning)
           (make-message-condition
             "should be a number")))
       23)))
    prints: should be a number
           ⇒ 65

(from https://docs.racket-lang.org/r6rs/r6rs-lib-std/r6rs-lib-Z-H-8.html#node_idx_378)
works in Guile

You might need to modify 'call-with-error-handling' in (guix ui) to recognise
&warning though, such that the &warning exception will be properly handled.

Alternatively, you can use the procedure 'warning' from (guix diagnostics).
To detect the error in this case, you can use parameterise, guix-warning-port
and procedures like call-with-output-string.  You may need to reset the locale
first (with dynamic-wind?).

Greetings,
Maxime.