aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristopher Baines <mail@cbaines.net>2019-05-20 08:17:56 +0100
committerChristopher Baines <mail@cbaines.net>2019-05-20 08:17:56 +0100
commit9c234514826187eb228a256f6a9c2e314e91f5d0 (patch)
tree7104ad403ace641d7ee2dbf2aa60f82924e34375
parent6add08b1094ed13c4dfab6a7609bb3a5099abe9e (diff)
downloaddata-service-9c234514826187eb228a256f6a9c2e314e91f5d0.tar
data-service-9c234514826187eb228a256f6a9c2e314e91f5d0.tar.gz
Handle the 404 case when viewing store items
-rw-r--r--guix-data-service/web/controller.scm6
-rw-r--r--guix-data-service/web/view/html.scm10
2 files changed, 15 insertions, 1 deletions
diff --git a/guix-data-service/web/controller.scm b/guix-data-service/web/controller.scm
index 79f2848..8482272 100644
--- a/guix-data-service/web/controller.scm
+++ b/guix-data-service/web/controller.scm
@@ -507,7 +507,11 @@
(let ((derivation (select-derivation-by-output-filename conn filename)))
(match derivation
(()
- #f)
+ (render-html
+ #:sxml (general-not-found
+ "Store item not found"
+ "No derivation found producing this output")
+ #:code 404))
(derivations
(render-html
#:sxml (view-store-item filename
diff --git a/guix-data-service/web/view/html.scm b/guix-data-service/web/view/html.scm
index 0a9aabb..cec4c19 100644
--- a/guix-data-service/web/view/html.scm
+++ b/guix-data-service/web/view/html.scm
@@ -29,6 +29,7 @@
#:use-module (texinfo html)
#:use-module (json)
#:export (index
+ general-not-found
unknown-revision
view-statistics
view-revision-package-and-version
@@ -1389,6 +1390,15 @@
(take data 2))
(vlist->list target-packages-vhash))))))))))))
+(define (general-not-found header-text body)
+ (layout
+ #:body
+ `(,(header)
+ (div
+ (@ (class "container"))
+ (h1 ,header-text)
+ (p ,body)))))
+
(define (unknown-revision commit-hash job)
(layout
#:body