Reason
  • Docs
  • Try
  • API
  • Community
  • Blog
  • Languages iconEnglish
    • 日本語
    • Deutsch
    • Español
    • Français
    • 한국어
    • Português (Brasil)
    • Русский
    • Українська
    • 中文
    • 繁體中文
    • Help Translate
  • GitHub
 Up  

Module Printexc.Slot

module Slot: sig .. end

type t = Printexc.backtrace_slot;
let is_raise: t => bool;
is_raise slot is true when slot refers to a raising point in the code, and false when it comes from a simple function call.
Since 4.02
let location: t => option(Printexc.location);
location slot returns the location information of the slot, if available, and None otherwise.

Some possible reasons for failing to return a location are as follow:

  • the slot corresponds to a compiler-inserted raise
  • the slot corresponds to a part of the program that has not been compiled with debug information (-g)

Since 4.02
let format: (int, t) => option(string);
format pos slot returns the string representation of slot as raw_backtrace_to_string would format it, assuming it is the pos-th element of the backtrace: the 0-th element is pretty-printed differently than the others.

Whole-backtrace printing functions also skip some uninformative slots; in that case, format pos slot returns None.
Since 4.02