From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.ciao.gmane.io!not-for-mail From: Maxim Cournoyer Newsgroups: gmane.lisp.guile.bugs Subject: bug#41956: [PATCH] ice-9: exceptions: Properly format the error message. Date: Sun, 28 Jun 2020 00:17:04 -0400 Message-ID: <87y2o7lt8f.fsf@gmail.com> 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> <87bll7qx5g.fsf@elephly.net> 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="91575"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.3 (gnu/linux) Cc: 41956@debbugs.gnu.org To: Ricardo Wurmus Original-X-From: bug-guile-bounces+guile-bugs=m.gmane-mx.org@gnu.org Sun Jun 28 06:18:07 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 1jpOlb-000Nhv-9M for guile-bugs@m.gmane-mx.org; Sun, 28 Jun 2020 06:18:07 +0200 Original-Received: from localhost ([::1]:35702 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jpOlZ-0004xP-UF for guile-bugs@m.gmane-mx.org; Sun, 28 Jun 2020 00:18:05 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:48692) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jpOlW-0004xJ-JE for bug-guile@gnu.org; Sun, 28 Jun 2020 00:18:02 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:33385) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1jpOlW-0006FZ-A5 for bug-guile@gnu.org; Sun, 28 Jun 2020 00:18:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1jpOlW-0001Tz-6v for bug-guile@gnu.org; Sun, 28 Jun 2020 00:18:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Maxim Cournoyer Original-Sender: "Debbugs-submit" Resent-CC: bug-guile@gnu.org Resent-Date: Sun, 28 Jun 2020 04:18:02 +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.15933178335621 (code B ref 41956); Sun, 28 Jun 2020 04:18:02 +0000 Original-Received: (at 41956) by debbugs.gnu.org; 28 Jun 2020 04:17:13 +0000 Original-Received: from localhost ([127.0.0.1]:44922 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1jpOkj-0001Sb-9P for submit@debbugs.gnu.org; Sun, 28 Jun 2020 00:17:13 -0400 Original-Received: from mail-qt1-f195.google.com ([209.85.160.195]:40208) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1jpOkh-0001SO-8a for 41956@debbugs.gnu.org; Sun, 28 Jun 2020 00:17:12 -0400 Original-Received: by mail-qt1-f195.google.com with SMTP id i16so10523854qtr.7 for <41956@debbugs.gnu.org>; Sat, 27 Jun 2020 21:17:11 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:references:date:in-reply-to:message-id :user-agent:mime-version:content-transfer-encoding; bh=zgZIQcfxauoXA14iJGW/qiozO7OBX2VKA4Zce4qGQI0=; b=ebFvjl1cXJHmCSPntWZPjsH8CCgJrhukLy+11WPfz0S/ON9UtJLfw63f9Y7gNvswXx 3m8XUJrq6kwGJ6bvXkfU/2CJig59KZiVAN6FMfOvYznnRsZvfdufen9RchIa5YxTZW78 3RcD2d3aqE5EQO5yAwETuKrMSLvTSK9Lhlc1oCx7+Mx1mcidHlCWUYNAX9v/R7vMM/kc Feb2xYsAvi5N4iv1i5hOlitIMwh0/mmYRrI/YRY9vDwHsBlCl11azF37QvTWO+q/zZhU Ix99XX4pkznFtWxbywXaGjtSF98lcjc0AnKU8Hs7X4rb/DqNZULxKRlflD3k3YS9Xfer ouCQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:references:date:in-reply-to :message-id:user-agent:mime-version:content-transfer-encoding; bh=zgZIQcfxauoXA14iJGW/qiozO7OBX2VKA4Zce4qGQI0=; b=pcd0BD4cxOyB2I7in52PQbC9B5+zM3DlIePAi9P68Qv8Ux8yGsMdyzGj1hu3gcSF8v EuYI2VjWA5T2kzqM8J55LhC+CplbYazHdNbm8zEh7k9JDUTL9RKBuzpIKFGl72aYChWa +Ct1UoYsSX8o8Hc8okqiHXdubluB109afrMC9UnQVY1N5Y10tW1tv17I4moquLP80s3h KNFrXrZYYLeL1cH9ElE4X8ioEhyBu7X/Az8aoMJl5Yzb6kgFYAJGSXWHJ3hZ+BnF9d+1 Gg0UjgKVahCzkoHkRffwfnaFHAn3hjwUo8HiSOtVoZRwCjtbrOLUCv1bqNNQSWGWSkUd 7yjg== X-Gm-Message-State: AOAM5327Co52q934PKD6Ke4Q8kL5FmtNxMwzgM9CqcZT2oXps6LTrfSY MyCn/HEPnvo3pesPc4EFtdGxiHnEbCc= X-Google-Smtp-Source: ABdhPJwEPjyIIlCrfPA+QVZZOb2oKOvT5lINdnPdHj3xNLSdjfJ6KxF7STFn8fwOheiteFa7gg7r7g== X-Received: by 2002:ac8:24c6:: with SMTP id t6mr9325395qtt.39.1593317825701; Sat, 27 Jun 2020 21:17:05 -0700 (PDT) Original-Received: from hurd (dsl-150-161.b2b2c.ca. [66.158.150.161]) by smtp.gmail.com with ESMTPSA id e203sm9331106qkb.87.2020.06.27.21.17.04 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 27 Jun 2020 21:17:05 -0700 (PDT) In-Reply-To: <87bll7qx5g.fsf@elephly.net> (Ricardo Wurmus's message of "Thu, 25 Jun 2020 12:04:27 +0200") 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:9833 Archived-At: Hello Ricardo! Ricardo Wurmus writes: > Hi Maxim, > > here=E2=80=99s what I did in the REPL: > > scheme@(guile-user)> ,m (ice-9 exceptions) > scheme@(ice-9 exceptions)> (define (my/guile-system-error-converter key a= rgs) > (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 'syste= m-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 I've tested that this indeed works, although I don't quite understand how? This brings embeds the definition of `guile-common-exceptions' into `guile-system-error-converter', with a single change: (make-exception-with-message msg) --> (apply make-exception-with-message msg msg-args) What is the magic I fail to see? Is this fix proper to be merged into the original guile-common-exceptions procedure? Thank you! Maxim