A report about a model: something found when it was compiled, or when it ran.
It is a Feel.Diagnostic put in its place in the model. FEEL says where in a text it found the problem; the compiler knows which
text that is, and the diagnostic says which element of the model (element, its id, or its name if it has none), where in it
(path, such as [:rule, 3, :input_entry, 2]) and where in the text (span, a byte range of the text of that part).
| Field | Is |
|---|---|
severity, code, message, hint, details | as for Feel.Diagnostic; code is also one of the compiler's (:unresolved_reference, :cyclic_requirements, :recursion_not_enabled, …) |
element | the id (or the name) of the element of the model, nil for the model itself |
path | where in the element |
span | the byte range in the text of that part, nil when the problem is the part and not a place in it |
box | the boxed expression it is in (Dmn.Compiler.Box: its kind, id and label), nil when it is in none |
phase | :compile for what was found without data, :run for what a run reported |
feel | the Feel.Diagnostic it was made from, if it was |
Summary
Functions
A diagnostic of FEEL, put in its place in the model by the source map of the unit that FEEL ran or prepared.
Makes a diagnostic.
Types
@type t() :: %Dmn.Diagnostic{ box: Dmn.Compiler.Box.t() | nil, code: atom(), details: map(), element: String.t() | nil, feel: Feel.Diagnostic.t() | nil, hint: String.t() | nil, message: String.t(), path: [term()], phase: :compile | :run, severity: Feel.Diagnostic.severity(), span: Feel.Diagnostic.span() | nil }
Functions
@spec from_feel( Feel.Diagnostic.t(), Dmn.Compiler.Source.finished(), String.t() | nil, :compile | :run ) :: t()
A diagnostic of FEEL, put in its place in the model by the source map of the unit that FEEL ran or prepared.
owner is the element of the unit, for a diagnostic that is in the glue of the unit and not in the text of a part (a span the
map does not know).
@spec new(Feel.Diagnostic.severity(), atom(), String.t(), keyword()) :: t()
Makes a diagnostic.
iex> diagnostic = Dmn.Diagnostic.new(:error, :unresolved_reference, "no element has the id d9", element: "d1")
iex> {diagnostic.severity, diagnostic.code, diagnostic.element, diagnostic.phase}
{:error, :unresolved_reference, "d1", :compile}