guix-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: dmd: [PATCH] Improve socket connection errors handling.


From: Ludovic Courtès
Subject: Re: dmd: [PATCH] Improve socket connection errors handling.
Date: Thu, 10 Apr 2014 16:52:35 +0200
User-agent: Gnus/5.130007 (Ma Gnus v0.7) Emacs/24.3 (gnu/linux)

Cyprien Nicolas <address@hidden> 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 <address@hidden>
> 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’.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]