Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 8 additions & 2 deletions src/graph_engine.jl
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion test/graph_engine_tests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -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)
)

Expand Down