GNU bug report logs - #41956
[PATCH] ice-9: exceptions: Properly format the error message.

Previous Next

Package: guile;

Reported by: Maxim Cournoyer <maxim.cournoyer <at> gmail.com>

Date: Fri, 19 Jun 2020 21:34:01 UTC

Severity: normal

Tags: patch

Full log


Message #17 received at 41956 <at> debbugs.gnu.org (full text, mbox):

From: Ricardo Wurmus <rekado <at> elephly.net>
To: Maxim Cournoyer <maxim.cournoyer <at> gmail.com>
Cc: 41956 <at> debbugs.gnu.org, Bengt Richter <bokr <at> bokr.com>
Subject: Re: bug#41956: [PATCH] ice-9: exceptions: Properly format the error
 message.
Date: Thu, 25 Jun 2020 12:04:27 +0200
Hi Maxim,

here’s what I did in the REPL:

--8<---------------cut here---------------start------------->8---
scheme@(guile-user)> ,m (ice-9 exceptions)
scheme@(ice-9 exceptions)> (define (my/guile-system-error-converter key args)
  (apply (case-lambda
          ((subr msg-args msg errno . rest)
           ;; XXX TODO we should return a more specific error
           ;; (usually an I/O error) as expected by R6RS programs.
           ;; Unfortunately this often requires the 'filename' (or
           ;; other?) which is not currently provided by the native
           ;; Guile exceptions.
		   (make-exception
			(make-external-error)
            (make-exception-with-origin subr)
            (apply make-exception-with-message msg)
            (make-exception-with-irritants msg-args)))
          (_ (guile-external-error-converter key args)))
         args))
scheme@(ice-9 exceptions)> (set! guile-exception-converters (acons 'system-error my/guile-system-error-converter guile-exception-converters))
scheme@(ice-9 exceptions)> ,m (guile-user)
scheme@(guile-user)> (guard (c ((message-condition? c)
		  (format #t "message: ~a~%" (condition-message c))))
		  (canonicalize-path "/doesntexist"))
message: No such file or directory
$11 = #t
scheme@(guile-user)> 
--8<---------------cut here---------------end--------------->8---

-- 
Ricardo




This bug report was last modified 1 year and 304 days ago.

Previous Next


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