Refactor Parser Error Handling #1172
Draft
+450
−291
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
The synthesis parser in the exporter now properly handles the errors it was catching, instead of always printing the stacktrace to the user, it now displays clean errors in most cases. This PR also removes the logging wrapper that was previously being used essentially to wrap everything in a
try
-catch
. Errors now propagate through the parser as values with a newResult
class which is inspired by the Rust enum of the same name. Each error contains a message and a severity (Fatal
orWarning
), the latter refers to the severity on the entire parsing process, so an error might cause a function to completely fail, but the error can be recovered by a parent function. On instantiation, eachErr
automatically logs itself based on it's severity. For errors that are not even fatal for the originating function, anErr
should be instantiated but not returned, as to not break control flow.Objectives
Result
implementationResult
,Err
, andOk
classesComponents.py
Materials.py
JointHierarchy.py
Joints.py
PDMessage.py
PhysicalProperties.py
RigidGroup.py
Utilities.py
Testing Done
JIRA Issue