Skip to content

Commit

Permalink
fix(rpc): clean termination on server error
Browse files Browse the repository at this point in the history
if version initialization fails, terminate the connection cleanly

Signed-off-by: Rudi Grinberg <me@rgrinberg.com>

ps-id: b3645c0b-4c65-455c-b2ba-73da5f845993
  • Loading branch information
rgrinberg committed Dec 10, 2022
1 parent f4ee265 commit 130365b
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions otherlibs/dune-rpc/private/dune_rpc_private.ml
Original file line number Diff line number Diff line change
Expand Up @@ -544,10 +544,12 @@ module Client = struct
n.params
with
| Ok msg -> t.on_preemptive_abort msg
| Error _ ->
Code_error.raise
| Error error ->
terminate_with_error t
"fatal: server aborted connection, but couldn't parse reason"
[ ("reason", Sexp.to_dyn n.params) ]
[ ("reason", Sexp.to_dyn n.params)
; ("error", Conv.dyn_of_error error)
]
else
let* handler = t.handler in
let* result = V.Handler.handle_notification handler () n in
Expand Down

0 comments on commit 130365b

Please sign in to comment.