guix-patches
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[bug#27654] [PATCH] base: Report evaluation error.


From: Mathieu Othacehe
Subject: [bug#27654] [PATCH] base: Report evaluation error.
Date: Wed, 12 Jul 2017 18:32:37 +0200
User-agent: mu4e 0.9.18; emacs 25.2.1

Hi Ludo,

> While we’re at it, let’s avoid ‘error’ altogether (‘error’ raises a
> ‘misc-error’ exception, which is not very helpful.)

Ok, would the attached patch be ok ?

Thanks,

Mathieu
>From c9a3325c1c021564edc689ff2421b04c9e794052 Mon Sep 17 00:00:00 2001
From: Mathieu Othacehe <address@hidden>
Date: Tue, 11 Jul 2017 19:15:08 +0200
Subject: [PATCH] base: Report evaluation error.

* src/cuirass/base.scm (evaluate): Report an error if eof-object? is true on
  data read from port. Otherwise, suppose that data are correct and keep thins
  going.
---
 src/cuirass/base.scm | 15 ++++++++++++++-
 1 file changed, 14 insertions(+), 1 deletion(-)

diff --git a/src/cuirass/base.scm b/src/cuirass/base.scm
index 326a530..3506916 100644
--- a/src/cuirass/base.scm
+++ b/src/cuirass/base.scm
@@ -32,6 +32,7 @@
   #:use-module (ice-9 receive)
   #:use-module (srfi srfi-19)
   #:use-module (srfi srfi-34)
+  #:use-module (srfi srfi-35)
   #:export (;; Procedures.
             call-with-time-display
             fetch-repository
@@ -137,6 +138,10 @@ directory and the sha1 of the top level commit in this 
directory."
         (system* "./configure" "--localstatedir=/var"))
     (zero? (system* "make" "-j" (number->string (current-processor-count))))))
 
+(define-condition-type &evaluation-error &error
+  evaluation-error?
+  (name evaluation-error-spec-name))
+
 (define (evaluate store db spec)
   "Evaluate and build package derivations.  Return a list of jobs."
   (let* ((port (open-pipe* OPEN_READ
@@ -148,7 +153,15 @@ directory and the sha1 of the top level commit in this 
directory."
                            (%package-cachedir)
                            (object->string spec)
                            (%package-database)))
-         (jobs (read port)))
+         (jobs (match (read port)
+                 ;; If an error occured during evaluation report it,
+                 ;; otherwise, suppose that data read from port are
+                 ;; correct and keep things going.
+                 ((? eof-object?)
+                  (raise (condition
+                          (&evaluation-error
+                           (name (assq-ref spec #:name))))))
+                 (data data))))
     (close-pipe port)
     jobs))
 
-- 
2.13.2


reply via email to

[Prev in Thread] Current Thread [Next in Thread]