[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
04/06: Improve the 404 pages
From: |
Christopher Baines |
Subject: |
04/06: Improve the 404 pages |
Date: |
Sat, 14 Mar 2020 09:15:26 -0400 (EDT) |
cbaines pushed a commit to branch master
in repository data-service.
commit ebb8ab80664d63e21cf832667f7f8bac5731b440
Author: Christopher Baines <address@hidden>
AuthorDate: Sat Mar 14 12:55:34 2020 +0000
Improve the 404 pages
Render some HTML rather than the plain response.
---
guix-data-service/web/controller.scm | 24 ++++++++++++++++++++----
1 file 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))))
- branch master updated (baeae56 -> ded4df6), Christopher Baines, 2020/03/14
- 02/06: Increase the batch size for fetching builds/narinfo files, Christopher Baines, 2020/03/14
- 01/06: Set an order for select-outputs-without-known-nar-entries, Christopher Baines, 2020/03/14
- 04/06: Improve the 404 pages,
Christopher Baines <=
- 05/06: Provide more information if the server can't bind the port, Christopher Baines, 2020/03/14
- 06/06: Move and improve the "starting the server" message, Christopher Baines, 2020/03/14
- 03/06: Improve handling of errors, Christopher Baines, 2020/03/14