Tezex.Michelson.EncodeError exception (tezex v6.0.0)

Copy Markdown View Source

A value that doesn't fit its Michelson type, returned by Tezex.Michelson.encode/2 and raised by Tezex.Michelson.encode!/2.

  • reason: what went wrong, see reason/0.
  • path: where in the value, root first. A segment is a field or branch name (string), a tuple or list position (integer), :left / :right for an or branch without a name, {:key, k} for a map key or set element, and {:value, k} for the value under map key k.
  • value: the value that was rejected (nil for a missing field).
  • expected: what would have been accepted there.

Summary

Types

reason()

@type reason() ::
  :invalid_value
  | :missing_field
  | :unknown_field
  | :duplicate_field
  | :unknown_branch
  | :ambiguous_branch
  | :duplicate_key
  | :not_comparable
  | :not_passable
  | :unsupported_type

segment()

@type segment() ::
  String.t()
  | non_neg_integer()
  | :left
  | :right
  | {:key, term()}
  | {:value, term()}

t()

@type t() :: %Tezex.Michelson.EncodeError{
  __exception__: term(),
  expected: String.t(),
  path: [segment()],
  reason: reason(),
  value: term()
}