guix-commits
[Top][All Lists]
Advanced

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

03/03: ui: Add 'symlink' replacement with better error reporting.


From: Ludovic Courtès
Subject: 03/03: ui: Add 'symlink' replacement with better error reporting.
Date: Mon, 20 Apr 2015 20:46:34 +0000

civodul pushed a commit to branch master
in repository guix.

commit 44fd6ef137f4aa7b9eb9c999e57b450432c4e915
Author: Ludovic Courtès <address@hidden>
Date:   Mon Apr 20 22:37:20 2015 +0200

    ui: Add 'symlink' replacement with better error reporting.
    
    * guix/ui.scm (symlink): New procedure.
---
 guix/ui.scm |   16 ++++++++++++++++
 1 files changed, 16 insertions(+), 0 deletions(-)

diff --git a/guix/ui.scm b/guix/ui.scm
index f80ce37..e717ab7 100644
--- a/guix/ui.scm
+++ b/guix/ui.scm
@@ -42,6 +42,7 @@
   #:use-module (ice-9 match)
   #:use-module (ice-9 format)
   #:use-module (ice-9 regex)
+  #:replace (symlink)
   #:export (_
             N_
             P_
@@ -205,6 +206,21 @@ Report bugs to: ~a.") %guix-bug-report-address)
 General help using GNU software: <http://www.gnu.org/gethelp/>"))
   (newline))
 
+(define symlink
+  (let ((real-symlink (@ (guile) symlink)))
+    (lambda (target link)
+      "This is a 'symlink' replacement that provides proper error reporting."
+      (catch 'system-error
+        (lambda ()
+          (real-symlink target link))
+        (lambda (key proc fmt args errno)
+          ;; Augment the FMT and ARGS with information about LINK (this
+          ;; information is missing as of Guile 2.0.11, making the exception
+          ;; uninformative.)
+          (apply throw key proc "~A: ~S"
+                 (append args (list link))
+                 errno))))))
+
 (define (string->number* str)
   "Like `string->number', but error out with an error message on failure."
   (or (string->number str)



reply via email to

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