View Source Splode behaviour (splode v0.2.3)

Use this module to create your error aggregator and handler.

For example:

defmodule MyApp.Errors do
  use Splode, error_classes: [
    invalid: MyApp.Errors.Invalid,
    unknown: MyApp.Errors.Unknown
  ],
  unknown_error: MyApp.Errors.Unknown.Unknown
end

Summary

Callbacks

Converts a combination of a module and json input into an Splode exception.

Sets the path on the error or errors

Returns true if the given value is a splode error.

Combine errors into an error class

Turns any value into a splode error

Callbacks

@callback from_json(module(), map()) :: Splode.Error.t()

Converts a combination of a module and json input into an Splode exception.

This allows for errors to be serialized and deserialized

@callback set_path(Splode.Error.t() | [Splode.Error.t()], term() | [term()]) ::
  Splode.Error.t() | [Splode.Error.t()]

Sets the path on the error or errors

@callback splode_error?(term()) :: boolean()

Returns true if the given value is a splode error.

@callback to_class(any()) :: Splode.Error.t()

Combine errors into an error class

@callback to_error(any()) :: Splode.Error.t()

Turns any value into a splode error