We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
raiseorpush
Nondiscriminatory error handling in the raiseorpush context manager masks errors not related to parsing and validation.
For example, in parsers/pywrjsonparser.py changing lines 141-143 from the original code:
parsers/pywrjsonparser.py
with component_exc_capture("metadata") as cc: self.metadata = PywrMetadata(self.src["metadata"]) cc.capture_warnings(self.metadata)
to
with component_exc_capture("metadata") as cc: self.metadata = PywrMetadata(self.src["metadata"]) cc.capture_warnings("some other variable")
will not generate an exception.
To fix, update the __exit__ dunder method in lines 34-42 in utils .py to:
__exit__
def __exit__(self, exc_type, exc_obj, exc_tb): if isinstance(exc_obj, WNTREPANETTypeValidationErrorBundle): for error in exc_obj.errors: # Raise on warning implies raise on error if self.raise_warning or self.raise_error: raise error from None self.dest.errors[self.component].append(error) elif exc_obj is not None: raise(exc_obj) from exc_obj return not self.raise_warning
The text was updated successfully, but these errors were encountered:
No branches or pull requests
Nondiscriminatory error handling in the
raiseorpush
context manager masks errors not related to parsing and validation.For example, in
parsers/pywrjsonparser.py
changing lines 141-143 from the original code:to
will not generate an exception.
To fix, update the
__exit__
dunder method in lines 34-42 in utils .py to:The text was updated successfully, but these errors were encountered: