Library
Module
Module type
Parameter
Class
Class type
type location =
| Text of string
| Raw_backtrace of Printexc.raw_backtrace
The type of locations that make up the exception trace
*)exception Traced of exn * location list
Any exception and its trace
val wrap : location -> exn -> exn
Add location to this exception's trace. If the input exception is not already wrapped, it gets wrapped into a Traced
exception. If the original exception is already wrapped in a Traced
exception, it gets unwrapped and rewrapped with the new, extended trace.
Recover the original exception, for inspection purposes. For instance Traced(Not_found, [...])
would become Not_found
.
Wrap an exception with the current exception backtrace (stack trace recorded at the point where the exception was raised, assuming no other exception was raised in-between). This is only guaranteed to work right after catching an exception with a try-with.
val raise_at : location -> exn -> 'a
Raise or reraise an exception after adding a location to its trace.
Raise or reraise an exception after adding a text location to its trace. Typical usage is Trax.raise __LOC__ e
.
Re-raise an exception after wrapping it with the current exception backtrace (stack trace recorded at the point where the exception was raised, assuming no other exception was raised in-between). This is only guaranteed to work right after catching an exception with a try-with.
val print : out_channel -> exn -> unit
Print the exception and its trace.