View Source Draft.ErrorRenderer behaviour (Draft v1.0.2)

Implementation of this behaviour should be set in validator options as :error_renderer or in :draft application config with same key. Common pattern is to expect :message key in validator options and if it not set use default_message (use get_message function for it). Result of message function appears in Draft.errors error tuple as last element, for those validators who use Draft.Validator.ErrorMessage (in general they should).

Link to this section Summary

Link to this section Callbacks

Link to this callback

message(validator_options, default_message, context)

View Source
@callback message(
  validator_options :: list(),
  default_message :: String.t(),
  context :: list()
) :: any()

Link to this section Functions

Link to this function

get_message(options, default)

View Source