mirror of
https://github.com/c-cube/linol.git
synced 2025-12-05 19:00:34 -05:00
try to print backtraces when handlers fail
This commit is contained in:
parent
e5cb0a331b
commit
b7e89f67e4
1 changed files with 4 additions and 2 deletions
|
|
@ -171,10 +171,11 @@ module Make(IO : IO)
|
|||
let protect ~id f =
|
||||
IO.catch f
|
||||
(fun e ->
|
||||
let message = spf "%s\n%s" (Printexc.to_string e) (Printexc.get_backtrace()) in
|
||||
let r = Jsonrpc.Response.error id
|
||||
(Jsonrpc.Response.Error.make
|
||||
~code:Jsonrpc.Response.Error.Code.InternalError
|
||||
~message:(Printexc.to_string e) ())
|
||||
~message ())
|
||||
in
|
||||
send_response self r)
|
||||
in
|
||||
|
|
@ -222,11 +223,12 @@ module Make(IO : IO)
|
|||
IO.failwith (spf "cannot decode request: %s" e)
|
||||
end)
|
||||
(fun e ->
|
||||
let message = spf "%s\n%s" (Printexc.to_string e) (Printexc.get_backtrace()) in
|
||||
let r =
|
||||
Jsonrpc.Response.error id
|
||||
(Jsonrpc.Response.Error.make
|
||||
~code:Jsonrpc.Response.Error.Code.InternalError
|
||||
~message:(Printexc.to_string e) ())
|
||||
~message ())
|
||||
in
|
||||
send_response self r)
|
||||
in
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue