all messages for Guix-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* [bug#46805] [PATCH] guix: ui: Improved error reporting when user file eval fails
@ 2021-02-26 22:36 Rovanion Luckey
  2021-03-23 13:18 ` Xinglu Chen
                   ` (2 more replies)
  0 siblings, 3 replies; 5+ messages in thread
From: Rovanion Luckey @ 2021-02-26 22:36 UTC (permalink / raw)
  To: 46805


[-- Attachment #1.1: Type: text/plain, Size: 259 bytes --]

Added a specific error message for when the user provided scheme file being
evaluated in turn fails to load another file. Also clearified the error
message given on generic system errors, to make it clear where the error
originates from.

See attached patch.

[-- Attachment #1.2: Type: text/html, Size: 320 bytes --]

[-- Attachment #2: 0001-guix-ui-Improved-error-reporting-when-user-file-eval.patch --]
[-- Type: text/x-patch, Size: 1610 bytes --]

From 57126cbff38de728d64797551239723ed18575a5 Mon Sep 17 00:00:00 2001
From: Rovanion Luckey <rovanion.luckey@gmail.com>
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 clearified 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


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [bug#46805] [PATCH] guix: ui: Improved error reporting when user file eval fails
  2021-02-26 22:36 [bug#46805] [PATCH] guix: ui: Improved error reporting when user file eval fails Rovanion Luckey
@ 2021-03-23 13:18 ` Xinglu Chen
  2021-03-24 13:36   ` Rovanion Luckey
  2021-10-12 18:14 ` Rovanion Luckey
  2021-10-12 18:16 ` Rovanion Luckey
  2 siblings, 1 reply; 5+ messages in thread
From: Xinglu Chen @ 2021-03-23 13:18 UTC (permalink / raw)
  To: Rovanion Luckey, 46805

On Fri, Feb 26 2021, Rovanion Luckey wrote:

> Added a specific error message for when the user provided scheme file being
> evaluated in turn fails to load another file. Also clearified the error
> message given on generic system errors, to make it clear where the error
> originates from.

Great, much better than just saying "error: VAR unbound variable".

> Added a specific error message for when the user provided scheme file
> being evaluated in turn fails to load another file. Also clearified

Typo fix, s/clearified/clarified






^ permalink raw reply	[flat|nested] 5+ messages in thread

* [bug#46805] [PATCH] guix: ui: Improved error reporting when user file eval fails
  2021-03-23 13:18 ` Xinglu Chen
@ 2021-03-24 13:36   ` Rovanion Luckey
  0 siblings, 0 replies; 5+ messages in thread
From: Rovanion Luckey @ 2021-03-24 13:36 UTC (permalink / raw)
  To: 46805; +Cc: Xinglu Chen


[-- Attachment #1.1: Type: text/plain, Size: 38 bytes --]

Fixed the typo in the attached patch.

[-- Attachment #1.2: Type: text/html, Size: 64 bytes --]

[-- Attachment #2: 0001-guix-ui-Improved-error-reporting-when-user-file-eval.patch --]
[-- Type: text/x-patch, Size: 1609 bytes --]

From 57126cbff38de728d64797551239723ed18575a5 Mon Sep 17 00:00:00 2001
From: Rovanion Luckey <rovanion.luckey@gmail.com>
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


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [bug#46805] [PATCH] guix: ui: Improved error reporting when user file eval fails
  2021-02-26 22:36 [bug#46805] [PATCH] guix: ui: Improved error reporting when user file eval fails Rovanion Luckey
  2021-03-23 13:18 ` Xinglu Chen
@ 2021-10-12 18:14 ` Rovanion Luckey
  2021-10-12 18:16 ` Rovanion Luckey
  2 siblings, 0 replies; 5+ messages in thread
From: Rovanion Luckey @ 2021-10-12 18:14 UTC (permalink / raw)
  To: 46805

[-- Attachment #1: Type: text/plain, Size: 212 bytes --]

I should pattern match instead of using that long (car (cdr (car))) line
like something along the lines of (let ((which-file-failed (match rest ((_
_ file) file)))) ...). This will need the module (ice-9 match).

[-- Attachment #2: Type: text/html, Size: 237 bytes --]

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [bug#46805] [PATCH] guix: ui: Improved error reporting when user file eval fails
  2021-02-26 22:36 [bug#46805] [PATCH] guix: ui: Improved error reporting when user file eval fails Rovanion Luckey
  2021-03-23 13:18 ` Xinglu Chen
  2021-10-12 18:14 ` Rovanion Luckey
@ 2021-10-12 18:16 ` Rovanion Luckey
  2 siblings, 0 replies; 5+ messages in thread
From: Rovanion Luckey @ 2021-10-12 18:16 UTC (permalink / raw)
  To: 46805

[-- Attachment #1: Type: text/plain, Size: 210 bytes --]

Or maybe even better, I could do that on the args match: ('system-error
"open-file" . rest) becomes ('system-error "open-file" _ which-file-failed
. rest).

Both these suggestions should be credited to roptat.

[-- Attachment #2: Type: text/html, Size: 281 bytes --]

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2021-10-12 18:17 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-02-26 22:36 [bug#46805] [PATCH] guix: ui: Improved error reporting when user file eval fails Rovanion Luckey
2021-03-23 13:18 ` Xinglu Chen
2021-03-24 13:36   ` Rovanion Luckey
2021-10-12 18:14 ` Rovanion Luckey
2021-10-12 18:16 ` Rovanion Luckey

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.