package stdcompat

  1. Overview
  2. Docs
include module type of struct include Printexc end
type t = exn = ..

The type of exception values.

val to_string_default : exn -> string

Printexc.to_string_default e returns a string representation of the exception e, ignoring all registered exception printers.

  • since 4.09
val use_printers : exn -> string option

Printexc.use_printers e returns None if there are no registered printers and Some s with else as the resulting string otherwise.

  • since 4.09

Raw backtraces

Current call stack

Uncaught exceptions

val default_uncaught_exception_handler : exn -> Printexc.raw_backtrace -> unit

Printexc.default_uncaught_exception_handler prints the exception and backtrace on standard error output.

  • since 4.11

Manipulation of backtrace information

These functions are used to traverse the slots of a raw backtrace and extract information from them in a programmer-friendly format.

Raw backtrace slots

Exception slots

type raw_backtrace_entry = private int
val not_implemented : unit -> 'a
val backtrace_slots_of_raw_entry : 'a -> 'b
val raw_backtrace_entries : 'a -> 'b
type raw_backtrace = Printexc.raw_backtrace
type backtrace_slot = Printexc.backtrace_slot
type location = Printexc.location = {
  1. filename : string;
  2. line_number : int;
  3. start_char : int;
  4. end_char : int;
}
val to_string : exn -> string
module Slot = Printexc.Slot
type raw_backtrace_slot = Printexc.raw_backtrace_slot
val raise_with_backtrace : exn -> raw_backtrace -> 'a
val get_raw_backtrace_next_slot : Printexc.raw_backtrace_slot -> Printexc.raw_backtrace_slot option
val set_uncaught_exception_handler : (exn -> Printexc.raw_backtrace -> unit) -> unit
val backtrace_slots : Printexc.raw_backtrace -> Printexc.backtrace_slot array option
val raw_backtrace_length : Printexc.raw_backtrace -> int
val get_raw_backtrace_slot : Printexc.raw_backtrace -> int -> Printexc.raw_backtrace_slot
val convert_raw_backtrace_slot : Printexc.raw_backtrace_slot -> Printexc.backtrace_slot
val exn_slot_id : exn -> int
val exn_slot_name : exn -> string
val get_callstack : int -> raw_backtrace
val get_raw_backtrace : unit -> Printexc.raw_backtrace
val print_raw_backtrace : out_channel -> Printexc.raw_backtrace -> unit
val raw_backtrace_to_string : Printexc.raw_backtrace -> string
val print_backtrace : out_channel -> unit
val get_backtrace : unit -> string
val record_backtrace : bool -> unit
val backtrace_status : unit -> bool
val register_printer : (exn -> string option) -> unit
val print : ('a -> 'b) -> 'a -> 'b
val catch : ('a -> 'b) -> 'a -> 'b
OCaml

Innovation. Community. Security.