Type for tracking errors in an Error.t. This is a specialization of the Result type, where the Error constructor carries an Error.t.
A common idiom is to wrap a function that is not implemented on all platforms, e.g.:
val do_something_linux_specific : (unit -> unit) Or_error.t
try_with f catches exceptions thrown by
f and returns them in the Result.t as an
try_with_join is like
try_with, except that
f can throw exceptions or
return an Error directly, without ending up with a nested error; it is equivalent to
Result.join (try_with f).
ok_exn t throws an exception if
t is an
Error, and otherwise returns the
contents of the
of_exn exn is
Error (Error.of_exn exn).
error message value sexp_of_value constructs an
Error.t and returns it as a
For marking a given value as unimplemented. Typically combined with conditional compilation, where on some platforms the function is defined normally, and on some platforms it is defined as unimplemented. The supplied string should be the name of the function that is unimplemented.
combine_errors ts returns
Ok if every element in
Ok, else it returns
Error with all the errors in
ts. More precisely:
Ok a1; ...; Ok an = Ok
a1; ...; an
...; Error e1; ...; Error en; ...
| = Error (Error.of_list
e1; ...; en)