Error Metadata

enolib's errors provide rich textual and numerical information to applications:

  • The error message itself (usually a single line of text, by default in english, but a different locale can be passed when parsing the document too)
  • An excerpt snippet of the document, highlighting the line(s) where the issue occurred (by default this snippet is plaintext, but HTML or colored terminal text formatting are available by passing a different reporter when parsing the document)
  • A suggested cursor location in the document at which to start with manual error corrections - applications can use this to automatically guide/take the user to the right place in the document (the cursor position is provided both as a one-dimensional string index, as well as a line/column combination)
  • A suggested selection range in the document at which the user might want to start fixing the error - same purpose and indexing as the cursor location

Next page: Message