From: ludo@gnu.org (Ludovic Courtès)
To: Cyprien Nicolas <cyprien@nicolas.tf>
Cc: guix-devel@gnu.org
Subject: Re: dmd: [PATCH] Improve socket connection errors handling.
Date: Thu, 10 Apr 2014 16:52:35 +0200 [thread overview]
Message-ID: <87k3ax6xu4.fsf@gnu.org> (raw)
In-Reply-To: <20140410081446.GF9248@kubera.prv.maison> (Cyprien Nicolas's message of "Thu, 10 Apr 2014 10:14:46 +0200")
Cyprien Nicolas <cyprien@nicolas.tf> skribis:
> My first patch for dmd :-)
Very cool, welcome! :-)
Those backtraces had been bothering me for a while too, so thanks for
looking at it.
> From 6e8f871198b661b631a319f3abaef71bc6269fb7 Mon Sep 17 00:00:00 2001
> From: Cyprien Nicolas <cyp@fulax.fr>
> Date: Thu, 10 Apr 2014 10:07:06 +0200
> Subject: [PATCH] Improve socket connection errors handling.
>
> If the user running `deco' does not have the rights privileges to open
> the unix socket, the raised exception produces a backtrace.
>
> * modules/dmd/comm.scm (open-connection): Add a (catch
> 'system-error...) guard around the connect function call.
> The handler will abort the program in case of error.
I pushed a couple of patches that achieve the same result slightly
differently: ‘open-connection’ is left unchanged and it’s the caller’s
responsibility to handle any errors; clients use the new
‘with-system-error-handling’ macro do handle all ‘system-error’
exceptions gracefully.
One remark:
> + (lambda (key . args)
> + (display (format #f "Error: Cannot connect to socket `~a': ~a\n"
> + file (apply format #f (cadr args) (caddr args)))
> + (current-error-port))
This could be directly (format (current-error-port) ...).
Also, we avoid uses of ‘car’, ‘cadr’ etc. in favor of ‘match’ (at least
in new code.)
Thanks!
Ludo’.
next prev parent reply other threads:[~2014-04-10 14:52 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-04-10 8:14 dmd: [PATCH] Improve socket connection errors handling Cyprien Nicolas
2014-04-10 14:52 ` Ludovic Courtès [this message]
2014-04-10 15:16 ` Cyprien Nicolas
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
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87k3ax6xu4.fsf@gnu.org \
--to=ludo@gnu.org \
--cc=cyprien@nicolas.tf \
--cc=guix-devel@gnu.org \
/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.
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/guix.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.