From eac0b668c9276922ab7d06c433b1f676bda52814 Mon Sep 17 00:00:00 2001 From: James Harton Date: Sat, 2 Mar 2024 12:03:07 +1300 Subject: [PATCH] fix: Don't assume `UndefinedFunctionError` means the module is not a Reactor. --- lib/reactor.ex | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/reactor.ex b/lib/reactor.ex index 556198a..dd054c2 100644 --- a/lib/reactor.ex +++ b/lib/reactor.ex @@ -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)