Handle package versions not being found
This commit is contained in:
parent
571ed55c9f
commit
9a03cdff18
2 changed files with 33 additions and 22 deletions
|
|
@ -993,28 +993,34 @@
|
|||
'(application/json text/html)
|
||||
mime-types)
|
||||
((application/json)
|
||||
(render-json
|
||||
`((name . ,name)
|
||||
(version . ,version)
|
||||
,@(match metadata
|
||||
(((synopsis synopsis-locale description description-locale home-page file line column-number
|
||||
licenses))
|
||||
`((synopsis . ,(texinfo->variants-alist synopsis synopsis-locale))
|
||||
(description . ,(texinfo->variants-alist description description-locale))
|
||||
(location
|
||||
. ((file . ,file)
|
||||
(line . ,line)
|
||||
(column . ,column-number)))
|
||||
(home-page . ,home-page))))
|
||||
(derivations . ,(list->vector
|
||||
(map (match-lambda
|
||||
((system target file-name status outputs)
|
||||
`((system . ,system)
|
||||
(target . ,target)
|
||||
(derivation . ,file-name)
|
||||
(outputs . ,(list->vector outputs)))))
|
||||
derivations))))
|
||||
#:extra-headers http-headers-for-unchanging-content))
|
||||
(if (null? metadata)
|
||||
(render-json
|
||||
`((name . ,name)
|
||||
(version . ,version)
|
||||
(error . "package not found"))
|
||||
#:code 404)
|
||||
(render-json
|
||||
`((name . ,name)
|
||||
(version . ,version)
|
||||
,@(match metadata
|
||||
(((synopsis synopsis-locale description description-locale home-page file line column-number
|
||||
licenses))
|
||||
`((synopsis . ,(texinfo->variants-alist synopsis synopsis-locale))
|
||||
(description . ,(texinfo->variants-alist description description-locale))
|
||||
(location
|
||||
. ((file . ,file)
|
||||
(line . ,line)
|
||||
(column . ,column-number)))
|
||||
(home-page . ,home-page))))
|
||||
(derivations . ,(list->vector
|
||||
(map (match-lambda
|
||||
((system target file-name status outputs)
|
||||
`((system . ,system)
|
||||
(target . ,target)
|
||||
(derivation . ,file-name)
|
||||
(outputs . ,(list->vector outputs)))))
|
||||
derivations))))
|
||||
#:extra-headers http-headers-for-unchanging-content)))
|
||||
(else
|
||||
(render-html
|
||||
#:sxml (view-revision-package-and-version commit-hash
|
||||
|
|
@ -1030,6 +1036,9 @@
|
|||
#:header-link header-link
|
||||
#:version-history-link
|
||||
version-history-link)
|
||||
#:code (if (null? metadata)
|
||||
404
|
||||
200)
|
||||
#:extra-headers http-headers-for-unchanging-content)))))
|
||||
|
||||
(define* (render-revision-package-derivations mime-types
|
||||
|
|
|
|||
|
|
@ -243,6 +243,8 @@
|
|||
(div
|
||||
(@ (class "col-sm-12"))
|
||||
,(match package-metadata
|
||||
(()
|
||||
"Package not found at this version")
|
||||
(((synopsis synopsis-locale description description-locale home-page file line column-number
|
||||
licenses))
|
||||
`(dl
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue