Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

More informative error messages from the Add-API #1329

Open
SouthEndMusic opened this issue Mar 27, 2024 · 0 comments
Open

More informative error messages from the Add-API #1329

SouthEndMusic opened this issue Mar 27, 2024 · 0 comments
Labels
python Relates to one of the Ribasim python packages validation Related to model validation

Comments

@SouthEndMusic
Copy link
Collaborator

SouthEndMusic commented Mar 27, 2024

When using the Add-API, I encountered the following errors messages in which inclusion of the node type would be helpful.

  • When trying to add a node of a particular type with an ID that already exists:

ValueError: Node IDs have to be unique, but node_id=3 already exists.

Source:

node_id = node.node_id
if self.node.df is not None and node_id in self.node.df["node_id"].to_numpy():
raise ValueError(
f"Node IDs have to be unique, but {node_id=} already exists."
)

  • When trying to add an edge with a node that does not exist:

IndexError: Node does not contain node_id: [4]

Source:

if missing.size > 0:
raise IndexError(f"{tablename} does not contain node_id: {missing}")

@SouthEndMusic SouthEndMusic added the python Relates to one of the Ribasim python packages label Mar 27, 2024
@visr visr added the validation Related to model validation label Mar 27, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
python Relates to one of the Ribasim python packages validation Related to model validation
Projects
Status: To do
Development

No branches or pull requests

2 participants