Ergo.Context.add_error
You're seeing just the function
add_error
, go back to Ergo.Context module for more information.
Link to this function
add_error(ctx, code, message)
Examples
iex> alias Ergo.Context
iex> context =
...> Context.new(&Ergo.Parser.call/2, "Hello World")
...> |> Context.add_error(:unexpected_char, "Expected 'e' got '.'")
iex> assert is_nil(context.ast)
iex> assert {:error, [{:unexpected_char, "Expected 'e' got '.'"}]} = context.status
iex> alias Ergo.Context
iex> context =
...> Context.new(&Ergo.Parser.call/2, "Hello World")
...> |> Context.add_error(:unexpected_char, "Expected 'e' got '.'")
...> |> Context.add_error(:literal_failed, "Expected 'end'")
iex> assert is_nil(context.ast)
iex> assert {:error, [{:literal_failed, "Expected 'end'"}, {:unexpected_char, "Expected 'e' got '.'"}]} = context.status