diff options
author | Christopher Baines <mail@cbaines.net> | 2022-10-21 12:16:56 +0100 |
---|---|---|
committer | Christopher Baines <mail@cbaines.net> | 2022-10-21 12:16:56 +0100 |
commit | 5412d515e3b0b4585ae1faf5cf3eb0a5e63a7b22 (patch) | |
tree | 01d9c11a95c063e70e9517ba11d666cafe6e9043 /guix-build-coordinator/agent-messaging | |
parent | b782e752205422054c932bd3a8196dcfdc33b346 (diff) | |
download | build-coordinator-5412d515e3b0b4585ae1faf5cf3eb0a5e63a7b22.tar build-coordinator-5412d515e3b0b4585ae1faf5cf3eb0a5e63a7b22.tar.gz |
Copy upload error handling to the partial route
Diffstat (limited to 'guix-build-coordinator/agent-messaging')
-rw-r--r-- | guix-build-coordinator/agent-messaging/http/server.scm | 24 |
1 files changed, 18 insertions, 6 deletions
diff --git a/guix-build-coordinator/agent-messaging/http/server.scm b/guix-build-coordinator/agent-messaging/http/server.scm index 7facaa3..e4f7041 100644 --- a/guix-build-coordinator/agent-messaging/http/server.scm +++ b/guix-build-coordinator/agent-messaging/http/server.scm @@ -564,12 +564,24 @@ port. Also, the port used can be changed by passing the --port option.\n" (simple-format #f "error computing hash: ~A" exn)) (when (file-exists? file-name) - ;; I've seen exceptions happen here from lzip, so try - ;; deleting the tmp file so that it's re-uploaded. - (log-msg logger - 'WARN - (simple-format #f "deleting ~A" file-name)) - (delete-file file-name)) + (let ((md5-hash + (bytevector->base16-string + (file-hash (hash-algorithm md5) file-name))) + (file-bytes + (stat:size (stat file-name)))) + ;; I've seen exceptions happen here from lzip, so try + ;; deleting the tmp file so that it's re-uploaded. + (log-msg logger + 'WARN + (simple-format #f "deleting ~A" file-name)) + (delete-file file-name) + + (raise-exception + (make-exception + exn + (make-exception-with-irritants + `((file-bytes . ,file-bytes) + (md5-hash . ,md5-hash))))))) (raise-exception exn)) (lambda () |