Message ID | CAAaf0CAFkDTO=yTtkEQ5DxV0Vs0i7mmCFHn_0J4ucnys+AnqzQ@mail.gmail.com |
---|---|
State | New |
Headers | show |
Series | [bug#46805] guix: ui: Improved error reporting when user file eval fails | expand |
Context | Check | Description |
---|---|---|
cbaines/comparison | success | View comparision |
cbaines/git branch | success | View Git branch |
cbaines/applying patch | fail | View Laminar job |
cbaines/issue | success | View issue |
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
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).
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.
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