From 6b6b91dbc89101e8a463e5dd5605b7b62e9f3609 Mon Sep 17 00:00:00 2001 From: Matthew Butterick Date: Mon, 28 Sep 2015 14:09:25 -0500 Subject: [PATCH] more informative 404 page for project server --- server-routes.rkt | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/server-routes.rkt b/server-routes.rkt index 68c161e..1b7bb1e 100644 --- a/server-routes.rkt +++ b/server-routes.rkt @@ -172,10 +172,10 @@ (cons #f `(span ,@(map (λ(on) `(a ((href ,on)) ,on (span ((class "file-ext")) "." ,source-first-ext ,(format " (from ~a)" (->string (find-relative-path dashboard-dir source)))))) output-names)))] [else (define extra-row-string - (if (equal? source-minus-ext (remove-ext source)) ; escaped and unescaped versions are equal - "" ; no extra string needed - (format " (from ~a)" (->string (find-relative-path dashboard-dir source))))) - + (if (equal? source-minus-ext (remove-ext source)) ; escaped and unescaped versions are equal + "" ; no extra string needed + (format " (from ~a)" (->string (find-relative-path dashboard-dir source))))) + (cons #f `(a ((href ,filename)) ,(->string source-minus-ext) (span ((class "file-ext")) "." ,source-first-ext ,extra-row-string)))])] [else ; other non-source file (cons filename filename)]) @@ -253,6 +253,9 @@ ;; 404 route (define/contract (route-404 req) (request? . -> . response?) - (define error-text (format "route-404: Can't find ~a" (->string (req->path req)))) - (message error-text) - (response/xexpr+doctype `(html ,error-text))) + (define missing-path (->string (req->path req))) + (message (format "route-404: Can't find ~a" missing-path)) + (response/xexpr+doctype + `(html + (head (title "404 error") (link ((href "/error.css") (rel "stylesheet")))) + (body (div ((class "section")) (div ((class "title")) "404 error") (p ,(format "~v" missing-path) " was not found"))))))