EctoQueryParser.ParseError exception (EctoQueryParser v0.5.0)

Copy Markdown View Source

Exception struct returned (inside an {:error, _} tuple) when a query string fails to parse.

Carries enough position information to power editor diagnostics:

  • :message - human-readable description of what went wrong
  • :line - 1-based line number where parsing stopped
  • :column - 1-based column number where parsing stopped
  • :byte_offset - 0-based byte offset into the input where parsing stopped
  • :rest - the unconsumed remainder of the input (truncated)

Because this is an Exception, Exception.message/1 produces a one-line summary including the position, and the struct can be raised directly.

Note that only parse-stage failures return this struct; builder/validation errors (unknown field, field not allowed, etc.) keep their {:error, binary} shape since no source position is available at that stage.

Summary

Types

t()

@type t() :: %EctoQueryParser.ParseError{
  __exception__: true,
  byte_offset: non_neg_integer(),
  column: pos_integer(),
  line: pos_integer(),
  message: String.t(),
  rest: String.t()
}