better error messages

This commit is contained in:
Simon Cruanes 2024-06-18 16:26:15 -04:00
parent 14a48756a8
commit e8c7d3c879
No known key found for this signature in database
GPG key ID: EBFFF6F283F3A2B4

View file

@ -126,10 +126,11 @@ let parse_req_start ~client_addr ~get_time_s ~buf (bs : IO.Input.t) :
meth, path, version meth, path, version
with with
| Invalid_argument msg -> | Invalid_argument msg ->
Log.error (fun k -> k "invalid request line: `%s`: %s" line msg); Log.error (fun k -> k "invalid request line: %S: %s" line msg);
raise (Bad_req (400, "Invalid request line")) raise (Bad_req (400, "Invalid request line"))
| _ -> | exn ->
Log.error (fun k -> k "invalid request line: `%s`" line); Log.error (fun k ->
k "invalid request line: %S: %s" line (Printexc.to_string exn));
raise (Bad_req (400, "Invalid request line")) raise (Bad_req (400, "Invalid request line"))
in in
let meth = Meth.of_string meth in let meth = Meth.of_string meth in