Describe the bug
When using a switch expression, one gets a cryptic error from seemingly correct configuration? EDIT: After some digging the error comes up if one does not supply a default branch to the switch statement.
To Reproduce
defmodule FooReactor do
use Reactor
input(:foo)
switch :maybe_foo do
on input(:foo)
matches? &is_nil/1 do
step :do_foo do
run fn _, _ ->
{:ok, :noop}
end
end
end
end
end
Generates the follow error:
** (EXIT from #PID<0.98.0>) an exception was raised:
** (KeyError) key :steps not found in: nil
If you are using the dot syntax, such as map.field, make sure the left-hand side of the dot is a map
lib/foo.ex:22: FooReactor.__verify_spark_dsl__/1
Expected behavior
The module compiles cleanly without error OR a clearer error on what is missing. EDIT: It seems like default is meant to be optional? At least that's what it looks like from the code
Runtime
Version: 0.10.0
Additional context
I can try and open a PR with a failing test for this in a bit
Describe the bug When using a
switch
expression, one gets a cryptic error from seemingly correct configuration? EDIT: After some digging the error comes up if one does not supply adefault
branch to theswitch
statement.To Reproduce
Generates the follow error:
Expected behavior The module compiles cleanly without error OR a clearer error on what is missing. EDIT: It seems like
default
is meant to be optional? At least that's what it looks like from the codeRuntime
0.10.0
Additional context I can try and open a PR with a failing test for this in a bit