ExeQute.QError (exe_qute v0.1.1)

Copy Markdown

Parsed kdb+ backtrace returned when a server's .Q.trp error handler emits a ** Backtrace: string as the query response instead of raising a wire-level error.

ExeQute.query/2 and query/3 automatically detect such responses and return {:error, %ExeQute.QError{}} rather than wrapping the backtrace in an :ok tuple.

The struct keeps both the raw backtrace text and a list of parsed frames. inspect/1 renders the raw backtrace with line breaks preserved (so it shows readably in IEx), and to_string/1 returns the same text for use with IO.puts/1.

Summary

Functions

Returns true if value is a kdb+ backtrace string.

Parses a raw kdb+ backtrace string into an ExeQute.QError struct.

Types

frame()

@type frame() :: %{
  level: non_neg_integer(),
  code: String.t(),
  file: String.t() | nil,
  line: pos_integer() | nil,
  function: String.t() | nil
}

t()

@type t() :: %ExeQute.QError{frames: [frame()], raw: String.t()}

Functions

backtrace?(arg1)

@spec backtrace?(term()) :: boolean()

Returns true if value is a kdb+ backtrace string.

parse(raw)

@spec parse(String.t()) :: {:ok, t()} | :error

Parses a raw kdb+ backtrace string into an ExeQute.QError struct.

Returns :error if raw does not begin with the ** Backtrace: marker.

Example

iex> {:ok, %ExeQute.QError{frames: [%{level: 0} | _]}} =
...>   ExeQute.QError.parse("** Backtrace:  [0]  (.Q.trp)\n")