fix: Don't assume UndefinedFunctionError means the module is not a Reactor.

This commit is contained in:
James Harton 2024-03-02 12:03:07 +13:00
parent eeb9614271
commit eac0b668c9
Signed by: james
GPG key ID: 90E82DAA13F624F4

View file

@ -140,11 +140,11 @@ defmodule Reactor do
def run(reactor, inputs \\ %{}, context \\ %{}, options \\ [])
def run(reactor, inputs, context, options) when is_atom(reactor) do
with Reactor <- reactor.spark_is() do
if Spark.Dsl.is?(reactor, Reactor) do
run(reactor.reactor(), inputs, context, options)
else
{:error, "Module `#{inspect(reactor)}` is not a Reactor module"}
end
rescue
UndefinedFunctionError -> {:error, "Module `#{inspect(reactor)}` is not a Reactor module"}
end
def run(reactor, inputs, context, options)