Module Base.ErrorSource
include sig ... end
include Ppx_compare_lib.Comparable.S with type t := Base.Error.t
include Ppx_compare_lib.Equal.S with type t := Base.Error.t
include Ppx_hash_lib.Hashable.S_any with type t := Base.Error.t
include Sexplib0.Sexpable.S with type t := Base.Error.t
include Sexplib0.Sexpable.Of_sexp with type t := Base.Error.t
include Sexplib0.Sexpable.Sexp_of with type t := Base.Error.t
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 @ portableNote 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 @ portableval reraise_uncaught :
Base.Error.t ->
f:(unit -> 'a) @ local local ->
'a @@ portableRe-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 @@ portableval of_info : Base__.Info0.t -> Base.Error.t @@ portableinclude sig ... end
include Ppx_compare_lib.Comparable.S with type t := Base.Error.t
val compare : Base.Error.t -> Base.Error.t -> intinclude Ppx_compare_lib.Equal.S with type t := Base.Error.t
val equal : Base.Error.t -> Base.Error.t -> boolval globalize : Base.Error.t @ local -> Base.Error.tinclude Ppx_hash_lib.Hashable.S_any with type t := Base.Error.t
val hash_fold_t : Base.Error.t Ppx_hash_lib.hash_foldval hash : Base.Error.t -> Ppx_hash_lib.Std.Hash.hash_valueinclude Sexplib0.Sexpable.S with type t := Base.Error.t
include Sexplib0.Sexpable.Of_sexp with type t := Base.Error.t
include Sexplib0.Sexpable.Sexp_of with type t := Base.Error.t
val sexp_of_t : Base.Error.t -> Sexplib0.Sexp.tval t_sexp_grammar : Base.Error.t Sexplib0.Sexp_grammar.t @@ portableval t_of_sexp : Sexplib0.Sexp.t -> Base.Error.t @ portable @@ portableExplicitly 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 -> unitval to_string_hum : Base.Error.t -> string @@ portableto_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 @@ portableto_string_mach t outputs t as a sexp on a single line.
val of_string : string -> Base.Error.t @ portable @@ portableBe 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 @@ portableval of_lazy_sexp : Sexplib0.Sexp.t Base.Lazy.t -> Base.Error.t @@ portableval of_lazy_t : Base.Error.t Base.Lazy.t -> Base.Error.t @@ portableval of_thunk : (unit -> string) -> Base.Error.t @@ portableval of_portable_lazy :
string Base.Portable_lazy.t ->
Base.Error.t @ portable @@ portableval of_portable_lazy_sexp :
Sexplib0.Sexp.t Base.Portable_lazy.t ->
Base.Error.t @ portable @@ portableval of_portable_lazy_t :
Base.Error.t Base.Portable_lazy.t ->
Base.Error.t @ portable @@ portableval create :
('a : value_or_null). ?here:Stdlib.Lexing.position ->
?strict:unit ->
string ->
'a ->
('a -> Sexplib0.Sexp.t) ->
Base.Error.t @@ portableFor 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 @@ portableval createf : ('a, unit, string, Base.Error.t) Stdlib.format4 -> 'a @@ portableConstructs 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 @@ portablecreatef_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 @@ portableAdds a string to the front.
val tag_s : Base.Error.t -> tag:Sexplib0.Sexp.t -> Base.Error.t @@ portableAdds a sexp to the front.
val tag_s_lazy :
Base.Error.t ->
tag:Sexplib0.Sexp.t Base.Lazy.t ->
Base.Error.t @@ portableAdds 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 @@ portableAdds 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 @@ portableAdds 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 @@ portableCombines multiple infos into one.
val of_exn :
?backtrace:[ `Get | `This of string ] ->
exn ->
Base.Error.t @ portable @@ portableof_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 @@ portableval pp : Base.Formatter.t -> Base.Error.t -> unit @@ portablemodule Internal_repr : sig ... endmodule Portable : sig ... endval of_portable : Base.Error.Portable.t -> Base.Error.t @ portable @@ portableval to_portable : Base.Error.t @ portable -> Base.Error.Portable.t @@ portableval portabilize : Base.Error.t -> Base.Error.t @ portable @@ portableConstructs 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 @@ portableConvert to Portable.t via portabilize.
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.