View Source CozyKV.ValidationError exception (cozy_kv v0.2.0)

The error that is returned (or raised) when there is an issue in the validation process.

Error messages

By default, the error struct doesn't include message.

If you want to turn an error into a human-readable message, you should use Exception.message/1.

If you don't like the default error message, you are free to customize your own version using the information provided by the error struct.

Summary

Types

@type invalid_value() :: {:invalid_value, key: key(), type: type(), value: value()}
@type key() :: term()
@type missing_key() :: {:missing_key, key: key(), received_keys: [key()]}
@type t() :: %CozyKV.ValidationError{
  __exception__: true,
  message: term(),
  path: [key()],
  type: unknown_keys() | missing_key() | invalid_value()
}
@type type() :: term()
@type unknown_keys() ::
  {:unknown_keys, key: key(), known_keys: [key()], unknown_keys: [key(), ...]}
@type value() :: term()