Skip to content

Commit

Permalink
Error early on non globally unique node IDs
Browse files Browse the repository at this point in the history
Alleviates #1262
  • Loading branch information
visr committed Mar 25, 2024
1 parent 0acbbed commit 7de907e
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions core/src/model.jl
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,13 @@ function Model(config::Config)::Model
state = load_structvector(db, config, BasinStateV1)
n = length(get_ids(db, "Basin"))

sql = "SELECT node_id FROM Node ORDER BY node_id"
node_id = only(execute(columntable, db, sql))
if !allunique(node_id)
error(

Check warning on line 91 in core/src/model.jl

View check run for this annotation

Codecov / codecov/patch

core/src/model.jl#L91

Added line #L91 was not covered by tests
"Node IDs need to be globally unique until https://github.com/Deltares/Ribasim/issues/1262 is fixed.",
)
end
finally
# always close the database, also in case of an error
close(db)
Expand Down

0 comments on commit 7de907e

Please sign in to comment.