Skip to content

Refactor Parser Error Handling #1172

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

Draft
wants to merge 12 commits into
base: dev
Choose a base branch
from

Conversation

azaleacolburn
Copy link
Contributor

@azaleacolburn azaleacolburn commented Jun 26, 2025

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 new Result class which is inspired by the Rust enum of the same name. Each error contains a message and a severity (Fatal or Warning), 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, each Err automatically logs itself based on it's severity. For errors that are not even fatal for the originating function, an Err should be instantiated but not returned, as to not break control flow.

Objectives

  • Result implementation
  • Document Result, Err, and Ok classes
  • Replace old error handling with nicer alternative (both for the user and developer)
    • Components.py
    • Materials.py
    • JointHierarchy.py
    • Joints.py
    • PDMessage.py
    • PhysicalProperties.py
    • RigidGroup.py
    • Utilities.py
  • Put checks after every opaque fusion function. This should probably be it's own PR.

Testing Done

  • Successfully exported Dozer

JIRA Issue

@azaleacolburn azaleacolburn self-assigned this Jun 26, 2025
@azaleacolburn azaleacolburn added exporter refactor The most important part of software development. labels Jun 26, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
exporter refactor The most important part of software development.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant