mirror of
https://github.com/ash-project/ash.git
synced 2024-09-20 13:33:20 +12:00
fix: proper error message on invalid inline function calculation
This commit is contained in:
parent
6b5a1da66d
commit
2cbae1bd9a
1 changed files with 5 additions and 0 deletions
|
@ -133,6 +133,11 @@ defmodule Ash.Resource.Calculation do
|
|||
|
||||
def schema, do: @schema
|
||||
|
||||
def expr_calc(expr) when is_function(expr) do
|
||||
{:error,
|
||||
"Inline function calculations expect a function with arity 2. Got #{Function.info(expr)[:arity]}"}
|
||||
end
|
||||
|
||||
def expr_calc(expr) do
|
||||
{:ok, {Ash.Resource.Calculation.Expression, expr: expr}}
|
||||
end
|
||||
|
|
Loading…
Reference in a new issue