Vcs.Exn
Handling of exceptions in Vcs
.
This module is used to handle exceptions that can occur when using the Vcs API.
val reraise_with_context :
Vcs.Err.t ->
Stdlib.Printexc.raw_backtrace ->
step:Sexplib0.Sexp.t ->
_
reraise_with_context err bt ~step
raises the original error in the form of an exception E
, with step
added to err
's context. This is simply a convenient wrapper that combines Printexc.raise_with_backtrace
and Err.add_context
under the hood.
See the documentation of Printexc.print_backtrace
for information about how to obtain an uncorrupted backtrace.
Example:
let doing_something_with_arg vcs ~arg =
try Vcs.something vcs ~arg with
| Vcs.E err ->
let bt = Printexc.get_raw_backtrace () in
Vcs.Exn.reraise_with_context
err
bt
~step:[%sexp "doing_something_with_arg", { arg : Arg.t }]
;;
module Private : sig ... end