add CCError.guard_str_trace

This commit is contained in:
Simon Cruanes 2015-10-03 08:56:49 +02:00
parent cba2d04049
commit 42c4c310b4
2 changed files with 9 additions and 0 deletions

View file

@ -139,6 +139,10 @@ let guard_str f =
try `Ok (f())
with e -> of_exn e
let guard_str_trace f =
try `Ok (f())
with e -> of_exn_trace e
let wrap1 f x =
try return (f x)
with e -> `Error e

View file

@ -118,6 +118,11 @@ val guard_str : (unit -> 'a) -> ('a, string) t
(** Same as {!guard} but uses {!of_exn} to print the exception.
See {!register_printer} *)
val guard_str_trace : (unit -> 'a) -> ('a, string) t
(** Same as {!guard_str} but uses {!of_exn_trace} instead of {!of_exn} so
that the stack trace is printed.
@since NEXT_RELEASE *)
val wrap1 : ('a -> 'b) -> 'a -> ('b, exn) t
(** Same as {!guard} but gives the function one argument. *)