Packages

Convert Abacus expression into Ecto DSL expressions, and use them for where, selects, order_by, group_by or having clauses.

Current section

Files

Jump to
abacus_sql lib errors no_field_or_association_found.ex
Raw

lib/errors/no_field_or_association_found.ex

defmodule AbacusSql.NoFieldOrAssociationFoundError do
defexception [:name, :in, :ctx]
def exception(value) do
struct(__MODULE__, Keyword.take(value, [:name, :in, :ctx]))
end
def message(%__MODULE__{in: schema, name: name}) do
schema =
schema
|> to_string()
|> String.replace_leading("Elixir.", "")
"\"#{name}\" was neither found as a field nor as an association of #{schema}"
end
end