Module Catala_utils.Errors

Error formatting and helper functions

Error exception and printing

exception StructuredError of string * (string option * Pos.t) list

The payload of the expression is a main error message, with a list of secondary positions related to the error, each carrying an optional secondary message to describe what is pointed by the position.

val print_structured_error : ?is_warning:bool -> string -> (string option * Pos.t) list -> unit

Emits error or warning if is_warning is set to true.

Error exception and printing

val raise_spanned_error : ?span_msg:string -> Pos.t -> ( 'a, Stdlib.Format.formatter, unit, 'b ) Stdlib.format4 -> 'a
val raise_multispanned_error : (string option * Pos.t) list -> ( 'a, Stdlib.Format.formatter, unit, 'b ) Stdlib.format4 -> 'a
val raise_error : ( 'a, Stdlib.Format.formatter, unit, 'b ) Stdlib.format4 -> 'a
val raise_internal_error : ( 'a, Stdlib.Format.formatter, unit, 'b ) Stdlib.format4 -> 'a
val assert_internal_error : bool -> ( 'a, Stdlib.Format.formatter, unit, unit, unit, unit ) Stdlib.format6 -> 'a

Warning printing

val format_multispanned_warning : (string option * Pos.t) list -> ( 'a, Stdlib.Format.formatter, unit ) Stdlib.format -> 'a
val format_spanned_warning : ?span_msg:string -> Pos.t -> ( 'a, Stdlib.Format.formatter, unit ) Stdlib.format -> 'a
val format_warning : ( 'a, Stdlib.Format.formatter, unit ) Stdlib.format -> 'a