Rely on the default error page triggering for 404s
It is not immediately obvious how to avoid the error handler making a different 404 response when the application code returns an explicit 404 page. Since we were already replying "Resource not found" in all cases except one where we reply "File not found" not much is lost by relying on the error handler behavior.
This commit is contained in:
parent
234c7a0cb2
commit
e253848a15
2 changed files with 0 additions and 13 deletions
|
@ -64,9 +64,6 @@ let or_error_response r =
|
|||
let* r = r in
|
||||
match r with
|
||||
| Ok response -> Lwt.return response
|
||||
| Error (text, `Not_Found) ->
|
||||
Views.resource_not_found ~text
|
||||
|> string_of_html |> Dream.html ~status:`Not_Found
|
||||
| Error (text, status) -> Dream.respond ~status text
|
||||
|
||||
let default_log_warn ~status e =
|
||||
|
|
10
lib/views.ml
10
lib/views.ml
|
@ -206,16 +206,6 @@ let artifact
|
|||
txtf " (%a)" Fmt.byte_size size;
|
||||
]
|
||||
|
||||
let resource_not_found ~text =
|
||||
[
|
||||
H.h2 ~a:[ H.a_style "padding-top: 33vh" ]
|
||||
[ txtf "This resource does not exist" ];
|
||||
H.p [
|
||||
H.txt @@ Fmt.str "Error: '%s'" text
|
||||
];
|
||||
]
|
||||
|> layout ~title:"Resource not found"
|
||||
|
||||
let page_not_found ~target ~referer =
|
||||
[
|
||||
H.h2 ~a:[ H.a_style "padding-top: 33vh" ]
|
||||
|
|
Loading…
Reference in a new issue