diff options
author | Christopher Baines <mail@cbaines.net> | 2023-07-03 13:21:22 +0100 |
---|---|---|
committer | Christopher Baines <mail@cbaines.net> | 2023-07-03 13:21:22 +0100 |
commit | 1eaac4890e290490206f688584cbe3aa98c0857a (patch) | |
tree | e2a1dca0d01e9e88acc0e982747cb51f2d7e7112 /guix-qa-frontpage | |
parent | cb411204327f5a20ea7442f2bc2401c0e3d6ce52 (diff) | |
download | qa-frontpage-1eaac4890e290490206f688584cbe3aa98c0857a.tar qa-frontpage-1eaac4890e290490206f688584cbe3aa98c0857a.tar.gz |
Add guix-data-service-error->sexp
Diffstat (limited to 'guix-qa-frontpage')
-rw-r--r-- | guix-qa-frontpage/guix-data-service.scm | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/guix-qa-frontpage/guix-data-service.scm b/guix-qa-frontpage/guix-data-service.scm index 77a4960..acd4ad7 100644 --- a/guix-qa-frontpage/guix-data-service.scm +++ b/guix-qa-frontpage/guix-data-service.scm @@ -17,6 +17,8 @@ guix-data-service-error-response-body guix-data-service-error-response-code + guix-data-service-error->sexp + revision-derivation-changes-url revision-derivation-changes @@ -85,6 +87,37 @@ (and (guix-data-service-error? exn) (< (guix-data-service-error-response-code exn) 500))))) +(define (guix-data-service-error->sexp 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"))))) + (define* (revision-derivation-changes-url base-and-target-refs #:key systems) (string-append |