Packages

Generic Elixir models and portable validation for RelayMark documents and manifests

Current section

Files

Jump to
relay_mark_elixir lib relay_mark validation_error.ex
Raw

lib/relay_mark/validation_error.ex

defmodule RelayMark.ValidationError do
@moduledoc """
Raised when `RelayMark.validate_document!/1` receives an invalid document.
"""
defexception [:message, diagnostics: []]
@impl Exception
def exception(options) do
diagnostics = Keyword.fetch!(options, :diagnostics)
count = length(diagnostics)
%__MODULE__{
diagnostics: diagnostics,
message: "RelayMark document validation failed with #{count} diagnostic(s)."
}
end
end