tezos-base

Tezos: meta-package and pervasive type definitions for Tezos
Library tezos-base
type unwrapped = ..
include Tezos_error_monad.Sig.CORE with type error := unwrapped
val error_encoding : unwrapped Data_encoding.t
val pp : Format.formatter -> unwrapped -> unit
val register_error_kind : Tezos_error_monad.Sig.error_category -> id:string -> title:string -> description:string -> ?pp:( Format.formatter -> 'err -> unit ) -> 'err Data_encoding.t -> ( unwrapped -> 'err option ) -> ( 'err -> unwrapped ) -> unit

The error data type is extensible. Each module can register specialized error serializers id unique name of this error. Ex.: overflow_time_counter title more readable name. Ex.: Overflow of time counter description human readable description. Ex.: The time counter overflowed while computing delta increase pp formatter used to pretty print additional arguments. Ex.: The time counter overflowed while computing delta increase. Previous value %d. Delta: %d encoder decoder data encoding for this error. If the error has no value, specify Data_encoding.empty

Classify an error using the registered kinds

include Tezos_error_monad.Sig.EXT with type error := unwrapped
type unwrapped +=
| Unclassified of string(*

Catch all error when 'deserializing' an error.

*)

Catch all error when 'serializing' an error.

type unwrapped +=
| Unregistred_error of Data_encoding.json
val json_of_error : unwrapped -> Data_encoding.json

An error serializer

val error_of_json : Data_encoding.json -> unwrapped

Error documentation

type error_info = {
category : Tezos_error_monad.Sig.error_category;
id : string;
title : string;
description : string;
schema : Data_encoding.json_schema;
}

Error information

val pp_info : Format.formatter -> error_info -> unit
val get_registered_errors : unit -> error_info list

Retrieves information of registered errors

val unwrap : error -> unwrapped option
val wrap : unwrapped -> error