Skip to content

Commit ab7d633

Browse files
committed
review comments: remove dead Lwt.fail call (since Fmt.failwith raises)
1 parent 8d6bdca commit ab7d633

File tree

2 files changed

+7
-7
lines changed

2 files changed

+7
-7
lines changed

lib/dB.ml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ let (>>!=) x f =
88
x >>= function
99
| `Ok y -> f y
1010
| `Eof -> Lwt.fail_with "qubesdb-agent: end-of-file from QubesDB!"
11-
| `Error (`Unknown msg) -> Lwt.fail (Fmt.failwith "qubesdb-agent: %s" msg)
11+
| `Error (`Unknown msg) -> Fmt.failwith "qubesdb-agent: %s" msg
1212

1313
let starts_with str prefix =
1414
let ls = String.length str in
@@ -72,7 +72,7 @@ let full_db_sync t =
7272
Log.debug (fun f -> f "%S = %S" path data);
7373
t.store <- t.store |> KeyMap.add path data;
7474
loop ()
75-
| ty, _, _ -> Lwt.fail (Fmt.failwith "Unexpected QubesDB message: %s" (qdb_msg_to_string ty)) in
75+
| ty, _, _ -> Fmt.failwith "Unexpected QubesDB message: %s" (qdb_msg_to_string ty) in
7676
loop () >>= fun `Done ->
7777
Lwt_condition.broadcast t.notify (); (* (probably not needed) *)
7878
KeyMap.iter (fun k v ->

lib/rExec.ml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ module Flow = struct
8383
recv flow.dstream >>!= function
8484
| `Data_stdin, empty when Cstruct.len empty = 0 -> Lwt.return `Eof
8585
| `Data_stdin, data -> Lwt.return (`Ok data)
86-
| ty, _ -> Lwt.fail (Fmt.failwith "Unknown message type %ld received" (int_of_type ty))
86+
| ty, _ -> Fmt.failwith "Unknown message type %ld received" (int_of_type ty)
8787

8888
let read flow =
8989
if Cstruct.len flow.stdin_buf > 0 then (
@@ -200,7 +200,7 @@ let recv_hello t =
200200
recv t >>= function
201201
| `Eof -> Lwt.fail_with "End-of-file waiting for msg_hello"
202202
| `Ok (`Hello, resp) -> Lwt.return (get_peer_info_version resp)
203-
| `Ok (ty, _) -> Lwt.fail (Fmt.failwith "Expected msg_hello, got %ld" (int_of_type ty))
203+
| `Ok (ty, _) -> Fmt.failwith "Expected msg_hello, got %ld" (int_of_type ty)
204204

205205
let try_close flow return_code =
206206
Flow.close flow return_code >|= function
@@ -214,7 +214,7 @@ let with_flow ~ty ~domid ~port fn =
214214
Lwt.catch
215215
(fun () ->
216216
recv_hello client >>= function
217-
| version when version < 2l -> Lwt.fail (Fmt.failwith "Unsupported qrexec version %ld" version)
217+
| version when version < 2l -> Fmt.failwith "Unsupported qrexec version %ld" version
218218
| version ->
219219
Log.info (fun f -> f "client connected, \
220220
other end wants to use protocol version %lu, \
@@ -251,7 +251,7 @@ let parse_cmdline cmd =
251251
else (
252252
let cmd = String.sub cmd 0 (String.length cmd - 1) in
253253
match cmd |> split ':' with
254-
| None -> Lwt.fail (Fmt.failwith "Missing ':' in %S" cmd)
254+
| None -> Fmt.failwith "Missing ':' in %S" cmd
255255
| Some (user, cmd) -> Lwt.return (user, cmd)
256256
)
257257

@@ -376,7 +376,7 @@ let connect ~domid () =
376376
let t = { t; clients = Hashtbl.create 4; counter = 0; } in
377377
send_hello t.t >>= fun () ->
378378
recv_hello t.t >>= function
379-
| version when version < 2l -> Lwt.fail (Fmt.failwith "Unsupported qrexec version %ld" version)
379+
| version when version < 2l -> Fmt.failwith "Unsupported qrexec version %ld" version
380380
| version ->
381381
Log.info (fun f -> f "client connected, \
382382
other end wants to use protocol version %lu, \

0 commit comments

Comments
 (0)