@@ -231,7 +231,7 @@ let perform_io : type mode. mode _channel -> int Lwt.t = fun ch ->
231231 (function
232232 | Unix. Unix_error (Unix. EPIPE, _ , _ ) ->
233233 Lwt. return 0
234- | exn -> Lwt. fail exn ) [@ ocaml.warning " -4" ]
234+ | exn -> Lwt. reraise exn ) [@ ocaml.warning " -4" ]
235235 else
236236 perform ch.buffer ptr len
237237 in
@@ -525,7 +525,7 @@ let make :
525525 max = (match mode with
526526 | Input -> 0
527527 | Output -> size);
528- close = lazy (Lwt. catch close Lwt. fail );
528+ close = lazy (Lwt. catch close Lwt. reraise );
529529 abort_waiter = abort_waiter;
530530 abort_wakener = abort_wakener;
531531 main = wrapper;
@@ -537,7 +537,7 @@ let make :
537537 perform_io,
538538 fun pos cmd ->
539539 try seek pos cmd
540- with e when Lwt.Exception_filter. run e -> Lwt. fail e
540+ with e when Lwt.Exception_filter. run e -> Lwt. reraise e
541541 );
542542 } and wrapper = {
543543 state = Idle ;
@@ -678,7 +678,7 @@ struct
678678 let ptr = ic.ptr in
679679 if ptr = ic.max then
680680 refill ic >> = function
681- | 0 -> Lwt. fail End_of_file
681+ | 0 -> raise End_of_file
682682 | _ -> read_char ic
683683 else begin
684684 ic.ptr < - ptr + 1 ;
@@ -690,7 +690,7 @@ struct
690690 (fun () -> read_char ic > |= fun ch -> Some ch)
691691 (function
692692 | End_of_file -> Lwt. return_none
693- | exn -> Lwt. fail exn )
693+ | exn -> Lwt. reraise exn )
694694
695695 let read_line ic =
696696 let buf = Buffer. create 128 in
@@ -711,7 +711,7 @@ struct
711711 if cr_read then Buffer. add_char buf '\r' ;
712712 Lwt. return(Buffer. contents buf)
713713 | exn ->
714- Lwt. fail exn )
714+ Lwt. reraise exn )
715715 in
716716 read_char ic >> = function
717717 | '\r' -> loop true
@@ -723,7 +723,7 @@ struct
723723 (fun () -> read_line ic > |= fun ch -> Some ch)
724724 (function
725725 | End_of_file -> Lwt. return_none
726- | exn -> Lwt. fail exn )
726+ | exn -> Lwt. reraise exn )
727727
728728 let unsafe_read_into' ic blit buf ofs len =
729729 let avail = ic.max - ic.ptr in
@@ -771,7 +771,7 @@ struct
771771 let rec loop ic buf ofs len =
772772 read_into ic buf ofs len >> = function
773773 | 0 ->
774- Lwt. fail End_of_file
774+ raise End_of_file
775775 | n ->
776776 let len = len - n in
777777 if len = 0 then
@@ -985,7 +985,7 @@ struct
985985 if ic.max - ic.ptr < size then
986986 refill ic >> = function
987987 | 0 ->
988- Lwt. fail End_of_file
988+ raise End_of_file
989989 | _ ->
990990 read_block_unsafe ic size f
991991 else begin
@@ -1440,7 +1440,7 @@ let open_temp_file ?buffer ?flags ?perm ?temp_dir ?prefix ?(suffix = "") () =
14401440 Lwt. return (fname, chan))
14411441 (function
14421442 | Unix. Unix_error _ when n < 1000 -> attempt (n + 1 )
1443- | exn -> Lwt. fail exn )
1443+ | exn -> Lwt. reraise exn )
14441444 in
14451445 attempt 0
14461446
@@ -1468,7 +1468,7 @@ let create_temp_dir
14681468 Lwt. return name)
14691469 (function
14701470 | Unix. Unix_error (Unix. EEXIST, _ , _ ) when n < 1000 -> attempt (n + 1 )
1471- | exn -> Lwt. fail exn )
1471+ | exn -> Lwt. reraise exn )
14721472 in
14731473 attempt 0
14741474
@@ -1489,10 +1489,10 @@ let win32_unlink fn =
14891489 (* If everything succeeded but the final removal still failed,
14901490 restore original permissions *)
14911491 Lwt_unix. chmod fn st_perm >> = fun () ->
1492- Lwt. fail exn )
1492+ Lwt. reraise exn )
14931493 )
1494- (fun _ -> Lwt. fail exn )
1495- | exn -> Lwt. fail exn )
1494+ (fun _ -> Lwt. reraise exn )
1495+ | exn -> Lwt. reraise exn )
14961496
14971497let unlink =
14981498 if Sys. win32 then
@@ -1549,7 +1549,7 @@ let close_socket fd =
15491549 (function
15501550 (* Occurs if the peer closes the connection first. *)
15511551 | Unix. Unix_error (Unix. ENOTCONN, _ , _ ) -> Lwt. return_unit
1552- | exn -> Lwt. fail exn ) [@ ocaml.warning " -4" ])
1552+ | exn -> Lwt. reraise exn ) [@ ocaml.warning " -4" ])
15531553 (fun () ->
15541554 Lwt_unix. close fd)
15551555
@@ -1574,7 +1574,7 @@ let open_connection ?fd ?in_buffer ?out_buffer sockaddr =
15741574 ~mode: output (Lwt_bytes. write fd)))
15751575 (fun exn ->
15761576 Lwt_unix. close fd >> = fun () ->
1577- Lwt. fail exn )
1577+ Lwt. reraise exn )
15781578
15791579let with_close_connection f (ic , oc ) =
15801580 (* If the user already tried to close the socket and got an exception, we
@@ -1639,7 +1639,7 @@ let establish_server_generic
16391639 (function
16401640 | Unix. Unix_error (Unix. ECONNABORTED, _ , _ ) ->
16411641 Lwt. return `Try_again
1642- | e -> Lwt. fail e)
1642+ | e -> Lwt. reraise e)
16431643 in
16441644
16451645 Lwt. pick [try_to_accept; should_stop] >> = function
0 commit comments