Client refactor: Move handling of unix error from Error_monad
to stdlib-unix
This commit is contained in:
parent
41d30777a6
commit
5c2ba214f0
@ -507,8 +507,6 @@ let () =
|
||||
Data_encoding.(obj1 (req "msg" string))
|
||||
(function
|
||||
| Exn (Failure msg) -> Some msg
|
||||
| Exn (Unix.Unix_error (err, fn, _)) ->
|
||||
Some ("Unix error in " ^ fn ^ ": " ^ Unix.error_message err)
|
||||
| Exn exn -> Some (Printexc.to_string exn)
|
||||
| _ -> None)
|
||||
(fun msg -> Exn (Failure msg))
|
||||
|
@ -7,7 +7,19 @@
|
||||
(* *)
|
||||
(**************************************************************************)
|
||||
|
||||
open Error_monad
|
||||
let () =
|
||||
register_error_kind
|
||||
`Temporary
|
||||
~id:"unix_error"
|
||||
~title:"Unix error"
|
||||
~description:"An unhandled unix exception"
|
||||
~pp:Format.pp_print_string
|
||||
Data_encoding.(obj1 (req "msg" string))
|
||||
(function
|
||||
| Exn (Unix.Unix_error (err, fn, _)) ->
|
||||
Some ("Unix error in " ^ fn ^ ": " ^ Unix.error_message err)
|
||||
| _ -> None)
|
||||
(fun msg -> Exn (Failure msg))
|
||||
|
||||
let read_bytes ?(pos = 0) ?len fd buf =
|
||||
let len = match len with None -> Bytes.length buf - pos | Some l -> l in
|
||||
|
Loading…
Reference in New Issue
Block a user