error_handler: only show not found for `Not_Found

For all other error status codes we just pass on the suggested response.
This commit is contained in:
Reynir Björnsson 2022-07-14 11:43:41 +02:00
parent f3d8eea546
commit 9416e0552d

View file

@ -675,6 +675,8 @@ let error_template error _debug_info suggested_response =
let referer =
Option.bind error.Dream.request (fun req -> Dream.header req "referer")
in
match Dream.status suggested_response with
| `Not_Found ->
let html =
if is_iframe_page ~req:error.Dream.request then
Views.viz_not_found
@ -684,5 +686,7 @@ let error_template error _debug_info suggested_response =
Dream.set_header suggested_response "Content-Type" Dream.text_html;
Dream.set_body suggested_response @@ string_of_html html;
Lwt.return suggested_response
| _ ->
Lwt.return suggested_response
module Link = Link