summary refs log tree commit diff
diff options
context:
space:
mode:
authorLudovic Courtès <ludo@gnu.org>2018-08-29 22:28:06 +0200
committerLudovic Courtès <ludo@gnu.org>2018-08-29 23:32:01 +0200
commitde5cbd4a38a33e0412f1c481fe8e01a871dc13e5 (patch)
treeac05ef6e906e61318e32c7e5271bbe638b56ff01
parentcaf8a003b33f9ed59c8f9bf6fc2ca9929b96b63b (diff)
downloadguix-de5cbd4a38a33e0412f1c481fe8e01a871dc13e5.tar.gz
records: Adjust 'record-abi-mismatch-error' arguments.
Previously, 'display-error' (as used by 'warn-about-load-error', for
instance) would be called with a wrong number of arguments when a
'record-abi-mismatch-error' was caught:

  warning: failed to load '(gnu tests install)':
  Backtrace:
  [...]
  ERROR: In procedure display-error:
  Wrong number of arguments to #<procedure display-error (_ _ _ _ _ _)>

Now you get warnings and error reports as intended:

  warning: failed to load '(gnu tests install)':
  In procedure abi-check: <openssh-configuration>: record ABI mismatch; recompilation needed
  warning: failed to load '(gnu tests ssh)':
  In procedure abi-check: <openssh-configuration>: record ABI mismatch; recompilation needed

* guix/records.scm (print-record-abi-mismatch-error): Remove.
Remove top-level call to 'set-exception-printer!'.
(abi-check): Use arguments as expected by 'display-error'.
-rw-r--r--guix/records.scm17
1 files changed, 5 insertions, 12 deletions
diff --git a/guix/records.scm b/guix/records.scm
index da3ecdaaf8..1f11648e2c 100644
--- a/guix/records.scm
+++ b/guix/records.scm
@@ -52,17 +52,6 @@
       ((weird _ ...)                              ;weird!
        (syntax-violation name "invalid field specifier" #'weird)))))
 
-(define (print-record-abi-mismatch-error port key args
-                                         default-printer)
-  (match args
-    ((rtd . _)
-     ;; The source file where this exception is thrown must be recompiled.
-     (format port "ERROR: ~a: record ABI mismatch; recompilation needed"
-             rtd))))
-
-(set-exception-printer! 'record-abi-mismatch-error
-                        print-record-abi-mismatch-error)
-
 (eval-when (expand load eval)
   ;; The procedures below are needed both at run time and at expansion time.
 
@@ -81,7 +70,11 @@
 interface\" (ABI) for TYPE is equal to COOKIE."
     (with-syntax ((current-abi (current-abi-identifier type)))
       #`(unless (eq? current-abi #,cookie)
-          (throw 'record-abi-mismatch-error #,type)))))
+          ;; The source file where this exception is thrown must be
+          ;; recompiled.
+          (throw 'record-abi-mismatch-error 'abi-check
+                 "~a: record ABI mismatch; recompilation needed"
+                 '(#,type) '())))))
 
 (define-syntax make-syntactic-constructor
   (syntax-rules ()