aboutsummaryrefslogtreecommitdiff
path: root/guix-build-coordinator/utils.scm
diff options
context:
space:
mode:
authorChristopher Baines <mail@cbaines.net>2022-01-20 12:22:51 +0000
committerChristopher Baines <mail@cbaines.net>2022-01-20 12:22:51 +0000
commit820068ba632d0de7d38a7ce2cb1640ac3020682a (patch)
tree78480525e82d5a7bcf7499475b001f27502df6e1 /guix-build-coordinator/utils.scm
parentff7958dc6825812a695eda342c302f8da4093e9f (diff)
downloadbuild-coordinator-820068ba632d0de7d38a7ce2cb1640ac3020682a.tar
build-coordinator-820068ba632d0de7d38a7ce2cb1640ac3020682a.tar.gz
Use the chunked-input-ended-prematurely exception type properly
Diffstat (limited to 'guix-build-coordinator/utils.scm')
-rw-r--r--guix-build-coordinator/utils.scm25
1 files changed, 13 insertions, 12 deletions
diff --git a/guix-build-coordinator/utils.scm b/guix-build-coordinator/utils.scm
index b8fe58b..d8a567b 100644
--- a/guix-build-coordinator/utils.scm
+++ b/guix-build-coordinator/utils.scm
@@ -180,6 +180,17 @@
#f
close))
+(define &chunked-input-ended-prematurely
+ (make-exception-type '&chunked-input-error-prematurely
+ &external-error
+ '()))
+
+(define make-chunked-input-ended-prematurely-error
+ (record-constructor &chunked-input-ended-prematurely))
+
+(define chunked-input-ended-prematurely-error?
+ (record-predicate &chunked-input-ended-prematurely))
+
;; Chunked Responses
(define (read-chunk-header port)
"Read a chunk header from PORT and return the size in bytes of the
@@ -187,7 +198,8 @@ upcoming chunk."
(match (read-line port)
((? eof-object?)
;; Connection closed prematurely: there's nothing left to read.
- (error "chunked input ended prematurely"))
+ (raise-exception
+ (make-chunked-input-ended-prematurely-error)))
(str
(let ((extension-start (string-index str
(lambda (c)
@@ -198,17 +210,6 @@ upcoming chunk."
str)
16)))))
-(define &chunked-input-ended-prematurely
- (make-exception-type '&chunked-input-error-prematurely
- &external-error
- '()))
-
-(define make-chunked-input-ended-prematurely-error
- (record-constructor &chunked-input-ended-prematurely))
-
-(define chunked-input-ended-prematurely-error?
- (record-predicate &chunked-input-ended-prematurely))
-
(define* (make-chunked-input-port* port #:key (keep-alive? #f))
(define (close)
(unless keep-alive?