unofficial mirror of bug-guile@gnu.org 
 help / color / mirror / Atom feed
From: Ricardo Wurmus <rekado@elephly.net>
To: Maxim Cournoyer <maxim.cournoyer@gmail.com>
Cc: 41956@debbugs.gnu.org
Subject: bug#41956: [PATCH] ice-9: exceptions: Properly format the error message.
Date: Sun, 28 Jun 2020 06:31:44 +0200	[thread overview]
Message-ID: <875zbbq09b.fsf@elephly.net> (raw)
In-Reply-To: <87y2o7lt8f.fsf@gmail.com>


Hi Maxim,

>> here’s what I did in the REPL:
>>
>> 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)

Here I changed the order: “msg-args” appears before “msg”.  I don’t know
why the converter that’s currently in Guile assumes that the message
comes first.

>> scheme@(ice-9 exceptions)> (set! guile-exception-converters (acons 'system-error my/guile-system-error-converter guile-exception-converters))

guile-exception-converters is a lookup table in (ice-9 exceptions).  It
associates error keys with converter procedures.  Since
canonicalize-path throws a 'system-error I chose to only update the
'system-error association.  I didn’t want to affect all the other
converter procedures that end up using the common converter; maybe they
should be affected — I don’t know because I don’t have any test cases
other than canonicalize-path.

> 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?

I cannot parse your sentence, so I’m not sure what you mean.

> Is this fix proper to be merged into the original
> guile-common-exceptions procedure?

I think we should add tests of different exceptions with different keys
to be sure that modifying the common handler doesn’t have any unexpected
side-effects.

-- 
Ricardo





  reply	other threads:[~2020-06-28  4:31 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-06-19 21:33 bug#41956: [PATCH] ice-9: exceptions: Properly format the error message Maxim Cournoyer
2020-06-20  5:46 ` maxim.cournoyer
2020-06-20 18:33   ` Bengt Richter
2020-06-21  3:49     ` Maxim Cournoyer
2020-06-25 10:04       ` Ricardo Wurmus
2020-06-25 16:33         ` Bengt Richter
2020-06-28  4:25           ` Maxim Cournoyer
2020-06-28 18:23             ` Bengt Richter
2020-06-28  4:17         ` Maxim Cournoyer
2020-06-28  4:31           ` Ricardo Wurmus [this message]
2021-06-02  7:32 ` bug#41956: is this still current ? Adriano Peluso
2023-11-10  4:17   ` Maxim Cournoyer

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/guile/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=875zbbq09b.fsf@elephly.net \
    --to=rekado@elephly.net \
    --cc=41956@debbugs.gnu.org \
    --cc=maxim.cournoyer@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).