From 0183efb93c4c4ae874faf55064ea2d287cb320f5 Mon Sep 17 00:00:00 2001 From: Rudi Grinberg Date: Mon, 26 Jan 2015 20:29:39 -0500 Subject: [PATCH] refactor raise (Failure x) better written as failwith x --- async/cohttp_async.ml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/async/cohttp_async.ml b/async/cohttp_async.ml index 1afec0d5f6..3989a44081 100644 --- a/async/cohttp_async.ml +++ b/async/cohttp_async.ml @@ -25,14 +25,14 @@ module Net = struct let lookup uri = let host = Option.value (Uri.host uri) ~default:"localhost" in match Uri_services.tcp_port_of_uri ~default:"http" uri with - | None -> raise (Failure "Net.connect") (* TODO proper exception *) + | None -> failwith "Net.connect" (* TODO proper exception *) | Some port -> let open Unix in Addr_info.get ~host [Addr_info.AI_FAMILY PF_INET; Addr_info.AI_SOCKTYPE SOCK_STREAM] >>= function | {Addr_info.ai_addr=ADDR_INET(addr,_)}::_ -> return (host, Ipaddr_unix.of_inet_addr addr, port) - | _ -> raise (Failure "resolution failed") + | _ -> failwith "resolution failed" let connect_uri ?interrupt uri = lookup uri >>= fun (host, addr, port) -> @@ -176,8 +176,8 @@ module Client = struct >>= fun () -> Response.read ic >>| function - | `Eof -> raise (Failure "Connection closed by remote host") - | `Invalid reason -> raise (Failure reason) + | `Eof -> failwith "Connection closed by remote host" + | `Invalid reason -> failwith reason | `Ok res -> (* Build a response pipe for the body *) let reader = Response.make_body_reader res ic in