jon.recoil.org

Module Base.ErrorSource

type t = Base__.Info0.t
include sig ... end

Be careful that the body of the lazy or thunk does not access mutable data, since it will only be called at an undetermined later point.

include sig ... end
val raise : ('a : value_or_null). Base.Error.t -> 'a @ portable

Note that the exception raised by this function maintains a reference to the t passed in.

val raise_s : ('a : value_or_null). Sexplib0.Sexp.t -> 'a @ portable
val reraise_uncaught : Base.Error.t -> f:(unit -> 'a) @ local local -> 'a @@ portable

Re-raise exceptions raised from f with this t as context. If this function raises, the exception maintains a reference to the t passed in.

val to_info : Base.Error.t -> Base__.Info0.t @@ portable
val of_info : Base__.Info0.t -> Base.Error.t @@ portable
include sig ... end
include Ppx_compare_lib.Comparable.S with type t := Base.Error.t
val compare : Base.Error.t -> Base.Error.t -> int
include Ppx_compare_lib.Equal.S with type t := Base.Error.t
val equal : Base.Error.t -> Base.Error.t -> bool
val globalize : Base.Error.t @ local -> Base.Error.t
val t_sexp_grammar : Base.Error.t Sexplib0.Sexp_grammar.t @@ portable
val t_of_sexp : Sexplib0.Sexp.t -> Base.Error.t @ portable @@ portable

Explicitly indicate that t_of_sexp produces a portable t. This is nicer for the user: you can do more things with a portable t, e.g. move it between domains.

val invariant : Base.Error.t -> unit
val to_string_hum : Base.Error.t -> string @@ portable

to_string_hum forces the lazy message, which might be an expensive operation.

to_string_hum usually produces a sexp; however, it is guaranteed that to_string_hum (of_string s) = s.

If this string is going to go into a log file, you may find it useful to ensure that the string is only one line long. To do this, use to_string_mach t.

val to_string_mach : Base.Error.t -> string @@ portable

to_string_mach t outputs t as a sexp on a single line.

val of_string : string -> Base.Error.t @ portable @@ portable

Be careful that the body of the lazy or thunk does not access mutable data, since it will only be called at an undetermined later point.

val of_lazy : string Base.Lazy.t -> Base.Error.t @@ portable
val of_lazy_sexp : Sexplib0.Sexp.t Base.Lazy.t -> Base.Error.t @@ portable
val of_lazy_t : Base.Error.t Base.Lazy.t -> Base.Error.t @@ portable
val of_thunk : (unit -> string) -> Base.Error.t @@ portable
val of_portable_lazy : string Base.Portable_lazy.t -> Base.Error.t @ portable @@ portable
val of_portable_lazy_sexp : Sexplib0.Sexp.t Base.Portable_lazy.t -> Base.Error.t @ portable @@ portable
val of_portable_lazy_t : Base.Error.t Base.Portable_lazy.t -> Base.Error.t @ portable @@ portable
val create : ('a : value_or_null). ?here:Stdlib.Lexing.position -> ?strict:unit -> string -> 'a -> ('a -> Sexplib0.Sexp.t) -> Base.Error.t @@ portable

For create message a sexp_of_a, sexp_of_a a is lazily computed, when the info is converted to a sexp. So if a is mutated in the time between the call to create and the sexp conversion, those mutations will be reflected in the sexp. Use ~strict:() to force sexp_of_a a to be computed immediately.

val create_s : Sexplib0.Sexp.t -> Base.Error.t @ portable @@ portable
val createf : ('a, unit, string, Base.Error.t) Stdlib.format4 -> 'a @@ portable

Constructs a t containing only a string from a format. This eagerly constructs the string.

val createf_portable : ('a, unit, string, unit -> Base.Error.t @ portable) Stdlib.format4 -> 'a @@ portable

createf_portable format arg1 arg2 ... () is like createf format arg1 arg2 ..., except creating a portable error.

val tag : Base.Error.t -> tag:string -> Base.Error.t @@ portable

Adds a string to the front.

val tag_s : Base.Error.t -> tag:Sexplib0.Sexp.t -> Base.Error.t @@ portable

Adds a sexp to the front.

val tag_s_lazy : Base.Error.t -> tag:Sexplib0.Sexp.t Base.Lazy.t -> Base.Error.t @@ portable

Adds a lazy sexp to the front.

val tag_s_portable_lazy : Base.Error.t -> tag:Sexplib0.Sexp.t Base.Portable_lazy.t -> Base.Error.t @@ portable

Adds a portable lazy sexp to the front.

val tag_arg : ('a : value_or_null). Base.Error.t -> string -> 'a -> ('a -> Sexplib0.Sexp.t) -> Base.Error.t @@ portable

Adds a string and some other data in the form of an s-expression at the front.

val of_list : Base.Error.t list -> Base.Error.t @@ portable

Combines multiple infos into one.

val of_exn : ?backtrace:[ `Get | `This of string ] -> exn -> Base.Error.t @ portable @@ portable

of_exn and to_exn are primarily used with Error, but their definitions have to be here because they refer to the underlying representation.

~backtrace:`Get attaches the backtrace for the most recent exception. The same caveats as for Printexc.print_backtrace apply. ~backtrace:(`This s) attaches the backtrace s. The default is no backtrace.

val to_exn : Base.Error.t -> exn @@ portable
val pp : Base.Formatter.t -> Base.Error.t -> unit @@ portable
module Internal_repr : sig ... end
module Portable : sig ... end
val of_portable : Base.Error.Portable.t -> Base.Error.t @ portable @@ portable
val to_portable : Base.Error.t @ portable -> Base.Error.Portable.t @@ portable
val portabilize : Base.Error.t -> Base.Error.t @ portable @@ portable

Constructs a portable info out of a possibly non-portable info. This operation is less expensive than err |> sexp_of_t |> create_s, but it's not a no-op.

It's not a no-op because it needs to force any non-portable computation of the input info.

val to_portable_portabilize : Base.Error.t -> Base.Error.Portable.t @@ portable

Convert to Portable.t via portabilize.

Sourcemodule Utf8 : sig ... end

Unlike the standard to_string_* functions under S, these encode any t that's represented by a sexp 1 using Sexp.Utf8.to_string_*, ensuring that valid UTF-8 sexp atoms get printed as-is. Standard to_string_* functions, by contrast, encode sexps using Sexp.to_string_*, encoding UTF-8 / other non-ASCII characters using escape sequences.