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

Fix the handle of not applicable NetworkModification when throwException boolean is present #3204

Open
alicecaron opened this issue Nov 7, 2024 · 0 comments · May be fixed by #3304
Open
Assignees

Comments

@alicecaron
Copy link
Contributor

In the NetworkModification::apply methods that take the throwException boolean in input parameter the use of AbstractNetworkModification::logOrThrow method should be called when the network modification cannot be applied.

This method allows to either log the not applicable reason as a warning (if throwException=false) or to throw a PowsyblException (if throwException=true).

Problem:
Some of the NetworkModification::apply method implementations do not call this method when the modification can not be applied.

Solution:
Fix each of thoses implementations to use the logOrThrow method.

Example:
In ConnectGenerator::apply we throw a PowsyblException in some case, but we should logOrThrow instead (and in case it is a log we should then return):

Replace

throw new PowsyblException("Generator '" + generatorId + "' not found");

With

logOrThrow(throwException, "Generator '" + generatorId + "' not found");
return;
@alicecaron alicecaron moved this from TODO to In Progress in Release 03/2025 Jan 30, 2025
@cphili cphili self-assigned this Jan 30, 2025
cphili added a commit that referenced this issue Jan 31, 2025
cphili added a commit that referenced this issue Jan 31, 2025
cphili added a commit that referenced this issue Feb 3, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: In Progress
3 participants