package picos

  1. Overview
  2. Docs

Wrapper for exceptions with backtraces.

type t = {
  1. exn : exn;
  2. bt : Stdlib.Printexc.raw_backtrace;
}

An exception and a backtrace.

val get : exn -> t

get exn is equivalent to { exn; bt = Printexc.get_raw_backtrace () }.

val get_callstack : int -> exn -> t

get_callstack n exn is equivalent to { exn; bt = Printexc.get_callstack n }.

Note that Printexc.get_callstack 0 effectively returns a constant value and this function is optimized to take that into account.

val raise : t -> 'a

raise exn_bt is equivalent to Printexc.raise_with_backtrace exn_bt.exn exn_bt.bt.

val discontinue : ('a, 'b) Stdlib.Effect.Deep.continuation -> t -> 'b

discontinue k exn_bt is equivalent to Effect.Deep.discontinue_with_backtrace k exn_bt.exn exn_bt.bt.

val discontinue_with : ('a, 'b) Stdlib.Effect.Shallow.continuation -> t -> ('b, 'c) Stdlib.Effect.Shallow.handler -> 'c

discontinue_with k exn_bt h is equivalent to Effect.Shallow.discontinue_with_backtrace k exn_bt.exn exn_bt.bt h.

OCaml

Innovation. Community. Security.