Correctly catch syntax errors in node descriptions when reloading plugins #2947
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
This PR fixes an issue that occurred during the reload of nodes that had syntax errors in their description. This caused an uncaught
SyntaxErrorexception that was raised during the automatic parsing of the file inimportlib.reload, before reaching the validation step for the description (which ensures all the attributes have been correctly written, with the expected types and so on).On the UI side, this meant that the "Reload All Plugins" feature would stop without any notice as soon as a syntax error was encountered. This translated by the "Reloading plugins..." message being sent but never followed by another message.
With the changes in the PR, the
SyntaxErrorexception is correctly caught, and the node status set accordingly. This does not interrupt the reloading process for all the nodes anymore, and if an error is encountered, an error message is sent with the list of all the nodes that were not successfully reloaded.Nodes that are not reloaded because there has been no change in their description since the last time they were (re)loaded are not included in the error list.
A corresponding unit test is also added.