Otera.Undefined (otera v0.1.0)

Copy Markdown View Source

The value of a missing variable, attribute or item, like the default Undefined of Jinja2.

An undefined value prints as an empty string, is false, has a length of 0 and iterates as an empty sequence. Other operations on it, such as arithmetic, calls or attribute lookup, raise an Otera.Error with the message that Jinja2 gives, for example 'user' is undefined.

A custom filter, test or function can receive an undefined value as an argument.

Summary

Functions

Raises the error of an operation on undefined.

Returns the message of the error that an operation on undefined raises.

Types

t()

@type t() :: %Otera.Undefined{
  hint: String.t() | nil,
  kind: atom(),
  name: term(),
  obj: term()
}

Functions

fail(undefined)

@spec fail(t()) :: no_return()

Raises the error of an operation on undefined.

message(undefined)

@spec message(t()) :: String.t()

Returns the message of the error that an operation on undefined raises.