package codept-lib

  1. Overview
  2. Docs

Fault definitions and associated polycy

module Level : sig ... end
type explanation = string
type 'data tag

Fault definition

type 'data info = {
  1. tag : 'data tag;
  2. path : string list;
    (*

    hierarchical name for the fault

    *)
  3. expl : explanation;
    (*

    fault documentation

    *)
  4. printer : Format.formatter -> 'data -> unit;
}
type 'a printer = Format.formatter -> 'a -> unit
val info : string list -> explanation -> 'data printer -> 'data info
type fault =
  1. | Err : 'data tag * 'data -> fault
type value =
  1. | Fmt : 'data printer * 'data -> value
type t = fault
exception Fatal of value

When an error is critic (see Level.critical), we raise this exception which contains the value that describes the critical problem which its pretty-printer.

val emit : 'data info -> 'data -> t
type log_info = {
  1. silent : Level.t;
  2. level : Level.t;
  3. exit : Level.t;
}

Basic logging function

val log : log_info -> 'a printer -> 'a printer
module Log : sig ... end

Fixed level logging functions

module Policy : sig ... end

Fault handling polycy

type handler = {
  1. policy : Policy.t;
  2. err_formatter : Format.formatter;
}
val register : ?lvl:Level.t -> 'a info -> Policy.t -> Policy.t

Fault handling with policy

val handle : handler -> fault -> unit
val raise : handler -> 'a info -> 'a -> unit
val is_silent : Policy.t -> 'a info -> bool
OCaml

Innovation. Community. Security.