diff --git a/src/graph_engine.jl b/src/graph_engine.jl index a8c1d635..1a7ed203 100644 --- a/src/graph_engine.jl +++ b/src/graph_engine.jl @@ -1834,9 +1834,15 @@ function prepare_interfaces(model::Model, fform::F, lhs_interface, rhs_interface end function prepare_interfaces(::StaticInterfaces{I}, fform::F, lhs_interface, rhs_interfaces::NamedTuple) where {I, F} - if !(length(I) == 1) + if length(I) == 0 + n = "\n" error( - lazy"Expected only one missing interface, got $I of length $(length(I)) (node $fform with interfaces $(keys(rhs_interfaces)))" + lazy"Node '$(fform)' needs to be defined with one unspecified interface.$(n)$(n)Node '$(fform)' is currently specified with all interfaces: $(keys(rhs_interfaces)), but one needs to be left out." + ) + elseif length(I) > 1 + n = "\n" + error( + lazy"Node '$(fform)' is defined with too few interfaces (arguments), you need $(length(I)-1) more.$(n)$(n)Currently specified interfaces are: $(keys(rhs_interfaces)). Possible missing interfaces are: $(I), but check the documentation to see the specification options." ) end missing_interface = first(I) diff --git a/test/graph_engine_tests.jl b/test/graph_engine_tests.jl index a0a06575..71f07075 100644 --- a/test/graph_engine_tests.jl +++ b/test/graph_engine_tests.jl @@ -2243,7 +2243,7 @@ end in1 = getorcreate!(model, ctx, :in1, nothing) in2 = getorcreate!(model, ctx, :in2, nothing) out = getorcreate!(model, ctx, :out, nothing) - @test_throws "Expected only one missing interface, got () of length 0 (node sum with interfaces (:in, :out))" make_node!( + @test_throws "needs to be defined with one unspecified interface" make_node!( model, ctx, options, +, out, (in = in1, out = in2) )