FUNCTION

require_not_empty

pure function require_not_empty<T>(value: list<T>?, [message: text]): list<T>

Asserts that a list is non-null and non-empty.

Parameters

  • value — the list to be checked.
  • message — the message for the exception to be thrown if the list is null or empty

Returns

the passed value, but with type cast from list<T>? to list<T>

Throws

  • exception — if the provided list is null or empty

Since

0.9.0


pure function require_not_empty<T>(value: set<T>?, [message: text]): set<T>

Asserts that a set is non-null and non-empty.

Parameters

  • value — the set to be checked
  • message — the message for the exception to be thrown if the set is null or empty

Returns

the passed value, but with type cast from set<T>? to set<T>

Throws

  • exception — if the provided set is null or empty

Since

0.9.0


pure function require_not_empty<K, V>(value: map<K, V>?, [message: text]): map<K, V>

Asserts that a map is non-null and non-empty.

Parameters

  • value — the map to be checked
  • message — the message for the exception to be thrown if the map is null or empty

Returns

the passed value, but with type cast from map<K,V>? to map<K,V>

Throws

  • exception — if the provided map is null or empty

Since

0.9.0


pure function require_not_empty<T>(value: T?, [message: text]): T

Asserts that a value is non-null.

Parameters

  • value — the nullable value to be checked
  • message — the message for the exception to be thrown if the value is null

Returns

the passed value, but with type cast from T? to T

Throws

  • exception — if the provided value is null

Since

0.9.0

© 2026 Chromia