updates to error handling

pull/9/head
Matthew Butterick 11 years ago
parent e724bda6eb
commit afc06e463e

@ -0,0 +1,39 @@
* {
margin: 0;
padding: 0;
}
body {
padding: 1em;
font-family: "Source Code Pro";
}
.section {
border: 1px solid black;
}
.title {
background-color: #dfd;
}
.section > p {
margin-left: 5px;
margin-right: 5px;
}
.section > pre {
font-family: "Source Code Pro";
white-space: pre-wrap; /* css-3 */
background-color: #efe;
margin-left: 5px;
margin-right: 5px;
padding: 5px;
}
.error {
color: red;
font-size: large;
}

@ -210,15 +210,16 @@
(next-dispatcher)) (next-dispatcher))
;; error route ;; 404 route
(define/contract (route-404 req) (define/contract (route-404 req)
(request? . -> . response?) (request? . -> . response?)
(define error-text (format "Can't find ~a" (->string (req->path req)))) (define error-text (format "route-404: Can't find ~a" (->string (req->path req))))
(message error-text) (message error-text)
;`(html ,(slurp (build-path SERVER_EXTRAS_DIR "404.html"))) ;`(html ,(slurp (build-path SERVER_EXTRAS_DIR "404.html")))
(response/xexpr `(html ,error-text))) (response/xexpr `(html ,error-text)))
;; server route that returns xexpr (before conversion to html) ;; server route that returns xexpr (before conversion to html)
(define/contract (xexpr path) (define/contract (xexpr path)
(complete-path? . -> . xexpr?) (complete-path? . -> . xexpr?)

Loading…
Cancel
Save