MDL.Error exception (MDL v0.2.0)

Copy Markdown View Source

Why an operation failed (spec/api.md section 4), returned as {:error, %MDL.Error{}}, never raised by MDL itself. It's an exception, so a caller may raise it.

  • :code: an atom that names the problem and keeps its meaning across releases (:unknown_family, :past_end, :invalid_build). Match on it, not on the message.
  • :message: for people; it may change in any release.
  • :problems: for an error that stands for several (a build that doesn't validate, bindings with problems on several rows), each as an MDL.Problem; otherwise empty.

Summary

Types

t()

@type t() :: %MDL.Error{
  __exception__: term(),
  code: atom(),
  message: String.t(),
  problems: [MDL.Problem.t()]
}