diff --git a/guix/ui.scm b/guix/ui.scm index 1812b01272..7920335928 100644 --- a/guix/ui.scm +++ b/guix/ui.scm @@ -392,6 +392,8 @@ exiting. ARGS is the list of arguments received by the 'throw' handler." (('syntax-error proc message properties form . rest) (let ((loc (source-properties->location properties))) (warning loc (G_ "~a~%") message))) + (('unbound-variable _ ...) + (report-unbound-variable-error args)) (('srfi-34 obj) (if (message-condition? obj) (warning (G_ "failed to load '~a': ~a~%") diff --git a/tests/guix-build.sh b/tests/guix-build.sh index d16b92d189..37666ffd01 100644 --- a/tests/guix-build.sh +++ b/tests/guix-build.sh @@ -146,8 +146,8 @@ test `guix build -d --sources=transitive foo \ | wc -l` -eq 3 -# Unbound variables. -cat > "$module_dir/foo.scm"< "$module_dir/foo.scm" < "$module_dir/err" || true grep "unbound" "$module_dir/err" # actual error grep "forget.*(gnu packages base)" "$module_dir/err" # hint + +# Unbound variable at the top level. +cat > "$module_dir/foo.scm" < "$module_dir/err" +grep "unbound" "$module_dir/err" # actual error +grep "forget.*(guix build-system gnu)" "$module_dir/err" # hint + rm -f "$module_dir"/* # Wrong 'define-module' clause reported by 'warn-about-load-error'.