fix: proper error message on invalid inline function calculation

This commit is contained in:
Zach Daniel 2023-04-18 16:42:26 -04:00
parent 6b5a1da66d
commit 2cbae1bd9a

View file

@ -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