diff options
author | Christopher Baines <mail@cbaines.net> | 2023-06-16 22:55:00 +0100 |
---|---|---|
committer | Christopher Baines <mail@cbaines.net> | 2023-06-16 22:55:00 +0100 |
commit | 8a705dd48a7d867e9613b0c3bd794c9c4aad5183 (patch) | |
tree | 4e585d58dfaf5eeb26ea81c238dba7b2e4401f3a /guix-qa-frontpage/issue.scm | |
parent | f8c2008da7107ef1f5e9b1d1f06391d84cdc9a7c (diff) | |
download | qa-frontpage-8a705dd48a7d867e9613b0c3bd794c9c4aad5183.tar qa-frontpage-8a705dd48a7d867e9613b0c3bd794c9c4aad5183.tar.gz |
Improve error reporting on the issue page
This regressed when more data started to be cached, since the exceptions
couldn't be stored in the db, but now some of the information makes it
through.
Diffstat (limited to 'guix-qa-frontpage/issue.scm')
-rw-r--r-- | guix-qa-frontpage/issue.scm | 99 |
1 files changed, 70 insertions, 29 deletions
diff --git a/guix-qa-frontpage/issue.scm b/guix-qa-frontpage/issue.scm index f7d3d2a..abcf96e 100644 --- a/guix-qa-frontpage/issue.scm +++ b/guix-qa-frontpage/issue.scm @@ -123,12 +123,39 @@ (if base-and-target-refs (with-exception-handler (lambda (exn) - (simple-format - (current-error-port) - "exception fetching derivation changes: ~A\n" - exn) - - (values #f #f)) + (values + (if (guix-data-service-error? exn) + `((exception . guix-data-service-invalid-parameters) + (invalid_query_parameters + . + ,(filter-map + (match-lambda + ((param . val) + (and=> + (assoc-ref val "invalid_value") + (lambda (value) + (let ((message + (assoc-ref val "message"))) + (cons + param + `((value . ,value) + (error + ;; Convert the HTML error messages + ;; to something easier to handle + . ,(cond + ((string-contains message + "failed to process revision") + 'failed-to-process-revision) + ((string-contains message + "yet to process revision") + 'yet-to-process-revision) + (else + 'unknown)))))))))) + (assoc-ref + (guix-data-service-error-response-body exn) + "query_parameters")))) + `((exception . ,(simple-format #f "~A" exn)))) + #f)) (lambda () (revision-derivation-changes (revision-derivation-changes-url @@ -137,13 +164,13 @@ #:unwind? #t) (values #f #f))) (derivation-changes-counts - (if derivation-changes-data + (if change-details (derivation-changes-counts derivation-changes-data %systems-to-submit-builds-for) #f)) (builds-missing? - (if derivation-changes-data + (if change-details (builds-missing-for-derivation-changes? derivation-changes-data) #t)) @@ -153,10 +180,36 @@ (with-exception-handler (lambda (exn) (if (guix-data-service-error? exn) - ;; TODO Return some description this error that can be - ;; cached - #f - (raise-exception exn))) + `((exception . guix-data-service-invalid-parameters) + (invalid_query_parameters + . + ,(filter-map + (match-lambda + ((param . val) + (and=> + (assoc-ref val "invalid_value") + (lambda (value) + (let ((message + (assoc-ref val "message"))) + (cons + param + `((value . ,value) + (error + ;; Convert the HTML error messages + ;; to something easier to handle + . ,(cond + ((string-contains message + "failed to process revision") + 'failed-to-process-revision) + ((string-contains message + "yet to process revision") + 'yet-to-process-revision) + (else + 'unknown)))))))))) + (assoc-ref + (guix-data-service-error-response-body exn) + "query_parameters")))) + `((exception . ,(simple-format #f "~A" exn))))) (lambda () (revision-comparison (revision-comparison-url @@ -199,23 +252,11 @@ (lambda (series) (with-exception-handler (lambda (exn) - (unless - (and (guix-data-service-error? exn) - ;; This probably just means the target - ;; revision hasn't been processed yet. The - ;; Guix Data Service should send a more - ;; informative response though. - (and=> (assoc-ref - (guix-data-service-error-response-body exn) - "error") - (lambda (error) - (string=? error - "invalid query")))) - (simple-format - (current-error-port) - "failed fetching derivation changes for issue ~A: ~A\n" - (car series) - exn)) + (simple-format + (current-error-port) + "failed fetching derivation changes for issue ~A: ~A\n" + (car series) + exn) #f) (lambda () |