aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristopher Baines <mail@cbaines.net>2020-10-24 13:50:34 +0100
committerChristopher Baines <mail@cbaines.net>2020-10-24 13:50:34 +0100
commit30290970b8a4e2da9b7e37daaebc349b050e2cc8 (patch)
tree4f9b60127d65a7ff8c7f42126a8365947e23dd8f
parent8d2f91bbb11410e456f0963f7d2e45348693ab90 (diff)
downloadbuild-coordinator-30290970b8a4e2da9b7e37daaebc349b050e2cc8.tar
build-coordinator-30290970b8a4e2da9b7e37daaebc349b050e2cc8.tar.gz
Add the ability to ignore errors when retrying
As this will enable responding to some exceptions at a higher level.
-rw-r--r--guix-build-coordinator/utils.scm12
1 files changed, 11 insertions, 1 deletions
diff --git a/guix-build-coordinator/utils.scm b/guix-build-coordinator/utils.scm
index 5048d29..f12cab0 100644
--- a/guix-build-coordinator/utils.scm
+++ b/guix-build-coordinator/utils.scm
@@ -374,10 +374,20 @@ References: ~a~%"
(canonical-sexp->string (signed-string info)))))
(format #f "~aSignature: 1;~a;~a~%" info (gethostname) signature)))
-(define* (retry-on-error f #:key times delay)
+(define* (retry-on-error f #:key times delay ignore)
(let loop ((attempt 1))
(match (with-exception-handler
(lambda (exn)
+ (when (cond
+ ((list? ignore)
+ (any (lambda (test)
+ (test exn))
+ ignore))
+ ((procedure? ignore)
+ (ignore exn))
+ (else #f))
+ (raise-exception exn))
+
(cons #f exn))
(lambda ()
(cons #t (f)))