Skip to content

Commit 994eb60

Browse files
authored
Merge pull request #118 from xhtmlboi/revert-116-server-error
Revert "Show detailed diagnostics for 500 server errors"
2 parents 687da09 + 2f57a30 commit 994eb60

20 files changed

+14
-285
lines changed

CHANGES.md

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -84,12 +84,10 @@
8484

8585
#### Yocaml_unix
8686

87-
- Improve rendering of 500 error pages on server (by [Linda-Njau](https://github.com/Linda-Njau))
8887
- Adapt runtime to `is_file` (by [xvw](https://xvw.lol))
8988

9089
#### Yocaml_eio
9190

92-
- Improve rendering of 500 error pages on server (by [Linda-Njau](https://github.com/Linda-Njau))
9391
- Adapt runtime to `is_file` (by [xvw](https://xvw.lol))
9492

9593
#### Yocaml_git

lib/core/runtime.ml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ module Make (Runtime : Required.RUNTIME) = struct
2222
~in_exception_handler:true)
2323
exn
2424
in
25-
msg |> Runtime.log `Error |> Runtime.bind (fun () -> raise exn)
25+
msg |> Runtime.log `Error |> Runtime.bind (fun () -> raise Exit)
2626

2727
let runtimec error =
2828
let error = Runtime.runtime_error_to_string error in

lib/runtime/server.ml

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -107,12 +107,6 @@ module Pages = struct
107107
|> String.concat ""
108108
in
109109
Format.asprintf "<nav><h1>%s</h1></nav><ul>%s</ul>" top listing
110-
111-
let error500 msg =
112-
Format.asprintf
113-
"<h1>500 Internal server error</h1><hr /><p>The build failed while \
114-
refreshing the site.</p><pre>%s</pre>"
115-
msg
116110
end
117111

118112
let prompt port =

lib/runtime/server.mli

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,6 @@ module Pages : sig
5454

5555
val error404 : string -> string
5656
val directory : string list -> Kind.t list -> string
57-
val error500 : string -> string
5857
end
5958

6059
(** {1 Helpers} *)

plugins/yocaml_eio/server.ml

Lines changed: 5 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -60,22 +60,11 @@ let dir path lpath =
6060
render_html @@ Yocaml_runtime.Server.Pages.directory lpath children
6161

6262
let handler htdoc refresh _socket request _body =
63-
try
64-
refresh ();
65-
match get_requested_uri htdoc request with
66-
| Error404 -> error404 htdoc
67-
| File (path, str) -> file path str
68-
| Dir (path, lpath) -> dir path lpath
69-
with exn ->
70-
let msg =
71-
Format.asprintf "%a"
72-
(fun ppf exn ->
73-
Yocaml.Diagnostic.exception_to_diagnostic ~in_exception_handler:true
74-
ppf exn)
75-
exn
76-
in
77-
render_html ~status:`Internal_server_error
78-
(Yocaml_runtime.Server.Pages.error500 msg)
63+
let () = refresh () in
64+
match get_requested_uri htdoc request with
65+
| Error404 -> error404 htdoc
66+
| File (path, str) -> file path str
67+
| Dir (path, lpath) -> dir path lpath
7968

8069
let run ?custom_error_handler directory port program env =
8170
Eio.Switch.run (fun sw ->

plugins/yocaml_unix/server.ml

Lines changed: 5 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -82,22 +82,11 @@ let dir reqd path lpath =
8282

8383
let[@warning "-8"] handler htdoc refresh _socket
8484
(`V1 reqd : Httpcats.Server.reqd) =
85-
try
86-
refresh ();
87-
match get_requested_uri htdoc reqd with
88-
| Error404 -> error404 reqd htdoc
89-
| File (path, _) -> file reqd path
90-
| Dir (path, lpath) -> dir reqd path lpath
91-
with exn ->
92-
let msg =
93-
Format.asprintf "%a"
94-
(fun ppf exn ->
95-
Yocaml.Diagnostic.exception_to_diagnostic ~in_exception_handler:true
96-
ppf exn)
97-
exn
98-
in
99-
render_html ~status:`Internal_server_error reqd
100-
(Yocaml_runtime.Server.Pages.error500 msg)
85+
let () = refresh () in
86+
match get_requested_uri htdoc reqd with
87+
| Error404 -> error404 reqd htdoc
88+
| File (path, _) -> file reqd path
89+
| Dir (path, lpath) -> dir reqd path lpath
10190

10291
let run ?custom_error_handler directory port program =
10392
let refresh () = Runner.run ?custom_error_handler program in

test/e2e/bin/dune

Lines changed: 0 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -29,25 +29,3 @@
2929
yocaml_jingoo
3030
yocaml_cmarkit
3131
yocaml_markdown))
32-
33-
(executable
34-
(name unix_server_error)
35-
(modules server_error unix_server_error test_article)
36-
(libraries
37-
yocaml
38-
yocaml_unix
39-
yocaml_yaml
40-
yocaml_jingoo
41-
yocaml_cmarkit
42-
yocaml_markdown))
43-
44-
(executable
45-
(name eio_server_error)
46-
(modules server_error eio_server_error test_article)
47-
(libraries
48-
yocaml
49-
yocaml_eio
50-
yocaml_yaml
51-
yocaml_jingoo
52-
yocaml_cmarkit
53-
yocaml_markdown))

test/e2e/bin/eio_server_error.ml

Lines changed: 0 additions & 4 deletions
This file was deleted.

test/e2e/bin/server_error.ml

Lines changed: 0 additions & 45 deletions
This file was deleted.

test/e2e/bin/unix_server_error.ml

Lines changed: 0 additions & 4 deletions
This file was deleted.

0 commit comments

Comments
 (0)