Subject: Re: [bug#46805] [PATCH] guix: ui: Improved error reporting when user file eval fails

From: Rovanion Luckey <[email-masked]>
Date: Wed, 24 Mar 2021 14:36:02 +0100

Fixed the typo in the attached patch.
From 57126cbff38de728d64797551239723ed18575a5 Mon Sep 17 00:00:00 2001
From: Rovanion Luckey <[email-masked]>
Date: Fri, 26 Feb 2021 23:23:14 +0100
Subject: [PATCH] guix: ui: Improved error reporting when user file eval fails
 due to system errors

Added a specific error message for when the user provided scheme file being evaluated in turn fails to load another file. Also clarified the error message given on generic system errors, to make it clear where the error originates from.
---
 guix/ui.scm | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/guix/ui.scm b/guix/ui.scm
index 7fbd4c63a2..0eabf136f6 100644
--- a/guix/ui.scm
+++ b/guix/ui.scm
@@ -373,9 +373,14 @@ it doesn't."
   "Report the failure to load FILE, a user-provided Scheme file.
 ARGS is the list of arguments received by the 'throw' handler."
   (match args
+    (('system-error "open-file" . rest)
+     (let ((err (system-error-errno args))
+           (file-which-failed-to-open (car (cdr (car (cdr rest))))))
+       (report-error (G_ "while evaluating '~a', it failed opening '~a' with the error: ~a~%")
+                     file file-which-failed-to-open (strerror err))))
     (('system-error . rest)
      (let ((err (system-error-errno args)))
-       (report-error (G_ "failed to load '~a': ~a~%") file (strerror err))))
+       (report-error (G_ "failed to evaluate '~a', it raised the error: ~a~%") file (strerror err))))
     (('read-error "scm_i_lreadparen" message _ ...)
      ;; Guile's missing-paren messages are obscure so we make them more
      ;; intelligible here.
-- 
2.30.0