aboutsummaryrefslogtreecommitdiff
path: root/guix-data-service
diff options
context:
space:
mode:
authorChristopher Baines <mail@cbaines.net>2020-03-14 12:55:34 +0000
committerChristopher Baines <mail@cbaines.net>2020-03-14 12:55:34 +0000
commitebb8ab80664d63e21cf832667f7f8bac5731b440 (patch)
treed3da4d3b8fd574013c32bff3378b1652aadd89c3 /guix-data-service
parenta03e1601deda589d5b11a8472438e6fe60c39666 (diff)
downloaddata-service-ebb8ab80664d63e21cf832667f7f8bac5731b440.tar
data-service-ebb8ab80664d63e21cf832667f7f8bac5731b440.tar.gz
Improve the 404 pages
Render some HTML rather than the plain response.
Diffstat (limited to 'guix-data-service')
-rw-r--r--guix-data-service/web/controller.scm24
1 files changed, 20 insertions, 4 deletions
diff --git a/guix-data-service/web/controller.scm b/guix-data-service/web/controller.scm
index 6fb24fd..15d1b17 100644
--- a/guix-data-service/web/controller.scm
+++ b/guix-data-service/web/controller.scm
@@ -262,7 +262,11 @@
mime-types
body
conn)
- (not-found (request-uri request))))
+ (render-html
+ #:sxml (general-not-found
+ "Page not found"
+ "")
+ #:code 404)))
(define (delegate-to-with-secret-key-base f)
(or (f request
@@ -271,7 +275,11 @@
body
conn
secret-key-base)
- (not-found (request-uri request))))
+ (render-html
+ #:sxml (general-not-found
+ "Page not found"
+ "")
+ #:code 404)))
(match method-and-path-components
(('GET)
@@ -307,7 +315,11 @@
(if (string-suffix? ".drv" filename)
(render-formatted-derivation conn
(string-append "/gnu/store/" filename))
- (not-found (request-uri request))))
+ (render-html
+ #:sxml (general-not-found
+ "Not a derivation"
+ "The formatted display is only for derivations, where the filename ends in .drv")
+ #:code 404)))
(('GET "gnu" "store" filename "plain")
(if (string-suffix? ".drv" filename)
(let ((raw-drv
@@ -332,4 +344,8 @@
(('GET "job" job-id) (delegate-to jobs-controller))
(('GET _ ...) (delegate-to nar-controller))
((method path ...)
- (not-found (request-uri request)))))
+ (render-html
+ #:sxml (general-not-found
+ "Page not found"
+ "")
+ #:code 404))))