aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristopher Baines <mail@cbaines.net>2020-02-16 09:06:12 +0000
committerChristopher Baines <mail@cbaines.net>2020-02-16 09:06:12 +0000
commit6f97cec96210b1e4d4852af2a799d2e0936c5dcb (patch)
treee71d9295520caa2147d2c73314572df63221c9e7
parentcc370fae563b4836bfd8422689b85252cb3f09b5 (diff)
downloaddata-service-6f97cec96210b1e4d4852af2a799d2e0936c5dcb.tar
data-service-6f97cec96210b1e4d4852af2a799d2e0936c5dcb.tar.gz
Guard against build being missing from the output response
-rw-r--r--guix-data-service/builds.scm42
1 files changed, 22 insertions, 20 deletions
diff --git a/guix-data-service/builds.scm b/guix-data-service/builds.scm
index f64ff51..76d1fd0 100644
--- a/guix-data-service/builds.scm
+++ b/guix-data-service/builds.scm
@@ -234,26 +234,28 @@ initial connection on which HTTP requests are sent."
(if data
(catch #t
(lambda ()
- (let* ((derivation
- (assoc-ref data "derivation"))
- (build-id
- (ensure-build-exists
- conn
- build-server-id
- derivation
- #:derivation-output-details-set-id
- (cdr
- (vhash-assoc output
- derivation-output-paths-and-details-sets-ids)))))
- (insert-build-statuses-from-data
- conn
- build-server-id
- build-id
- (assoc-ref data "build"))
- (if (verbose-output?)
- (simple-format #t "found build for: ~A (~A)\n"
- output derivation)
- (display "-"))))
+ (when (assoc-ref data "build")
+ ;; The build can be #f
+ (let* ((derivation
+ (assoc-ref data "derivation"))
+ (build-id
+ (ensure-build-exists
+ conn
+ build-server-id
+ derivation
+ #:derivation-output-details-set-id
+ (cdr
+ (vhash-assoc output
+ derivation-output-paths-and-details-sets-ids)))))
+ (insert-build-statuses-from-data
+ conn
+ build-server-id
+ build-id
+ (assoc-ref data "build"))
+ (if (verbose-output?)
+ (simple-format #t "found build for: ~A (~A)\n"
+ output derivation)
+ (display "-")))))
(lambda (key . args)
(simple-format
(current-error-port)