Imp.Signature.ParseError exception (Imp v0.5.0)

Copy Markdown View Source

Raised when a signature string cannot be parsed.

Imp.Signature.new/2, and every constructor that takes a signature string, raises it. :input is the string as given and :position the offset where parsing stopped. The message quotes the input, points at that position, and suggests a spelling when the mistake is a near miss, such as a misspelled type.

iex> try do
...>   Imp.Signature.new("question -> answer: strng")
...> rescue
...>   error in Imp.Signature.ParseError -> error.position
...> end
18

Summary

Types

t()

@type t() :: %Imp.Signature.ParseError{
  __exception__: true,
  input: String.t(),
  message: String.t(),
  position: non_neg_integer()
}