From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.ciao.gmane.io!not-for-mail From: Ricardo Wurmus Newsgroups: gmane.lisp.guile.bugs Subject: bug#41956: [PATCH] ice-9: exceptions: Properly format the error message. Date: Thu, 25 Jun 2020 12:04:27 +0200 Message-ID: <87bll7qx5g.fsf@elephly.net> References: <87eeqad9m9.fsf@gmail.com> <87wo42mgre.fsf@hurd.i-did-not-set--mail-host-address--so-tickle-me> <20200620183334.GA9490@LionPure> <87r1u9m62o.fsf@gmail.com> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Injection-Info: ciao.gmane.io; posting-host="ciao.gmane.io:159.69.161.202"; logging-data="114749"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: mu4e 1.4.10; emacs 26.3 Cc: 41956@debbugs.gnu.org To: Maxim Cournoyer Original-X-From: bug-guile-bounces+guile-bugs=m.gmane-mx.org@gnu.org Thu Jun 25 12:05:11 2020 Return-path: Envelope-to: guile-bugs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1joOko-000Tjc-CI for guile-bugs@m.gmane-mx.org; Thu, 25 Jun 2020 12:05:10 +0200 Original-Received: from localhost ([::1]:35790 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1joOkn-0008Fs-91 for guile-bugs@m.gmane-mx.org; Thu, 25 Jun 2020 06:05:09 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:58888) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1joOkg-0008BI-9x for bug-guile@gnu.org; Thu, 25 Jun 2020 06:05:02 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:56404) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1joOkf-0001d3-QB for bug-guile@gnu.org; Thu, 25 Jun 2020 06:05:01 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1joOkf-0001dk-LD for bug-guile@gnu.org; Thu, 25 Jun 2020 06:05:01 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Ricardo Wurmus Original-Sender: "Debbugs-submit" Resent-CC: bug-guile@gnu.org Resent-Date: Thu, 25 Jun 2020 10:05:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 41956 X-GNU-PR-Package: guile X-GNU-PR-Keywords: patch Original-Received: via spool by 41956-submit@debbugs.gnu.org id=B41956.15930794836275 (code B ref 41956); Thu, 25 Jun 2020 10:05:01 +0000 Original-Received: (at 41956) by debbugs.gnu.org; 25 Jun 2020 10:04:43 +0000 Original-Received: from localhost ([127.0.0.1]:39717 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1joOkM-0001d9-QD for submit@debbugs.gnu.org; Thu, 25 Jun 2020 06:04:43 -0400 Original-Received: from sender4-of-o53.zoho.com ([136.143.188.53]:21370) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1joOkI-0001cx-JK for 41956@debbugs.gnu.org; Thu, 25 Jun 2020 06:04:41 -0400 ARC-Seal: i=1; a=rsa-sha256; t=1593079475; cv=none; d=zohomail.com; s=zohoarc; b=GbuLxxiNJU5iBGKnHuFosiqADgCh8wpgj7nGIat6Znt+SdjneRWy23i6/z2gMpbArF9xYiuAF0YZ/7wHth8LPaylmxdHOCQEqtcvNjipSWX83XGLarVtjz3l8AMzZ37jbPG6d0r6TEmjjfq3qLfevHuhplKVlwIQgObSp22V91o= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1593079475; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:MIME-Version:Message-ID:References:Subject:To; bh=Xqv4o5R0a8fK15/+KmnvygMsgnbcismlPD4tG+GMU7I=; b=jl/RnR/3Lta11qNx4wvIRPTSeHp6NUZ0nVZdzlh1apsOgmvD6F/t51BSuBVnLV8u+yPjIteScD6oLvUlDPxsCtLEbvnjt/YiVrUUYTQPsd1Sxs3ZvQ0dUpsRdHgcVBqdviHk50hdxA0cuM8Sw0B6zXydjH98ayU2ngzXWTfK5SQ= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass header.i=elephly.net; spf=pass smtp.mailfrom=rekado@elephly.net; dmarc=pass header.from= header.from= DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; t=1593079475; s=zoho; d=elephly.net; i=rekado@elephly.net; h=References:From:To:Cc:Subject:In-reply-to:Date:Message-ID:MIME-Version:Content-Type:Content-Transfer-Encoding; bh=Xqv4o5R0a8fK15/+KmnvygMsgnbcismlPD4tG+GMU7I=; b=DhqBgNdvhelrf4EWI6o1aDq4uDVCGx8afJv70Sos031CJDR3+c96mYOGQevdNeG5 5+OIq5c54c0Blkse+CEqUqpJw7lfw3R5QspWNNYO0EOcp30pRXtWYTNQL7/sqFFz3sA 387W8MzBYbFvR6ygz9W3fG79AgtjmOd4SVs6rZ7s= Original-Received: from localhost (p54ad4b85.dip0.t-ipconnect.de [84.173.75.133]) by mx.zohomail.com with SMTPS id 1593079471457234.82363824088588; Thu, 25 Jun 2020 03:04:31 -0700 (PDT) In-reply-to: <87r1u9m62o.fsf@gmail.com> X-URL: https://elephly.net X-PGP-Key: https://elephly.net/rekado.pubkey X-PGP-Fingerprint: BCA6 89B6 3655 3801 C3C6 2150 197A 5888 235F ACAC X-ZohoMailClient: External X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-guile@gnu.org List-Id: "Bug reports for GUILE, GNU's Ubiquitous Extension Language" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-guile-bounces+guile-bugs=m.gmane-mx.org@gnu.org Original-Sender: "bug-guile" Xref: news.gmane.io gmane.lisp.guile.bugs:9830 Archived-At: Hi Maxim, here=E2=80=99s 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 arg= s) (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 =3D #t scheme@(guile-user)>=20 --8<---------------cut here---------------end--------------->8--- --=20 Ricardo