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

Could there be any methods to analyses the warning throws? #83

Open
LittleBrize opened this issue Jul 16, 2021 · 1 comment
Open

Could there be any methods to analyses the warning throws? #83

LittleBrize opened this issue Jul 16, 2021 · 1 comment

Comments

@LittleBrize
Copy link

When I was using the python version of OWA-EPANET, I found all functions do not retrieve the integer values of warnings, as it's stated in "README". You know it's hard to check these basically identical warnings. Could there be any methods to analyses the warning throws?

@samhatchett
Copy link
Member

I see a couple of options here. First off, the relevant piece of SWIG wrapper is here:

PyErr_WarnEx(PyExc_Warning, "WARNING", 2);

... so EPANET has returned a non-zero (but less than 10) code, which indicates a warning. Our SWIG wrapper is inspecting the code and issuing the warning, so we could either:

  • format the numerical code into the warning string,
  • increase the stack_level parameter to give the user more insight into the wrapped function that generated the warning,
  • create a custom warning class that would contain the EPANET integer code as an instance variable

Any of these options would be a pretty minor tweak to the wrapper, but I list them here in case others have better ideas...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants