2
0
Fork 0
mirror of git://git.savannah.gnu.org/guix/data-service.git synced 2023-12-14 03:23:03 +01:00

Provide more information about revision processing errors

In the compare package derivations response.
This commit is contained in:
Christopher Baines 2023-06-15 11:36:46 +01:00
parent f7b823cfd9
commit 044a905c1d

View file

@ -648,28 +648,46 @@
'(application/json text/html) '(application/json text/html)
mime-types) mime-types)
((application/json) ((application/json)
(render-json (letpar& ((base-job
`((error . "invalid query") (and=> (match (assq-ref query-parameters 'base_commit)
(query_parameters (($ <invalid-query-parameter> value)
. (and (string? value) value))
,(map ((? string? value) value)
(match-lambda (_ #f))
((name . val) (lambda (commit)
(cons (with-thread-postgresql-connection
name (lambda (conn)
(cond (select-job-for-commit conn commit))))))
((invalid-query-parameter? val) (target-job
`((invalid (and=> (match (assq-ref query-parameters 'target_commit)
. ,(with-output-to-string (($ <invalid-query-parameter> value)
(lambda () (and (string? value) value))
(sxml->html ((? string? value) value)
(invalid-query-parameter-message (_ #f))
val))))) (lambda (commit)
(value . ,(invalid-query-parameter-value val)))) (with-thread-postgresql-connection
((list? val) (lambda (conn)
(list->vector val)) (select-job-for-commit conn commit)))))))
(else val))))) (render-json
query-parameters))))) `((error . "invalid query")
(query_parameters
.
,(map
(match-lambda
((key . val)
(cons key
(match val
(($ <invalid-query-parameter> value message)
`((invalid_value . ,value)
(message . ,(call-with-output-string
(lambda (port)
(sxml->html message port))))))
((? list? val)
(list->vector val))
(val val)))))
query-parameters))
(base_job . ,base-job)
(target_job . ,target-job)))))
(else (else
(letpar& ((systems (letpar& ((systems
(with-thread-postgresql-connection (with-thread-postgresql-connection