package touist

  1. Overview
  2. Docs

This is where the compiler errors are managed.

We call a 'message' an error or a warning. Two cases for displaying the errors:

  • either one of the parse/eval/smt/sat function will raise the TouistFatal exception. In this case, after the exception is catched, you can run print_msgs.
  • or no fatal error has been encoundered; if you want to display the errors, you can run print_msgs.

Rules for good error or warning messages:

  • a message must always end with a newline
  • use a new line (\n) only when the line break is mandatory for understanding. The text will be wrapped automatically.
  • use indentations for pieces of code you want to show: the indentation will be kept when wrapping as long as no \n is encountered. Indented text is colored.
  • the text in simple quote '...' or backquotes `...` is colored
type msg_type =
  1. | Error
  2. | Warning
type during =
  1. | Usage
  2. | Parse
  3. | Lex
  4. | Eval
  5. | Sat
  6. | Cnf
  7. | Prenex
type msg = msg_type * during * string * loc option
exception TouistFatal of msg
val string_of_loc : ?fmt:string -> loc -> string
val string_of_msg : ?width:int -> ?color:bool -> ?fmt:string -> msg -> string

Give errors

val warn : msg -> unit
val fatal : msg -> 'a

Change the error formatting

val wrap_width : int Pervasives.ref
val format : string Pervasives.ref
val loc_format : string Pervasives.ref
val color : bool Pervasives.ref
val discard_warnings : bool Pervasives.ref
OCaml

Innovation. Community. Security.