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

Move exceptions to new module #1845

Merged
merged 5 commits into from
Oct 17, 2024
Merged

Conversation

dlakaplan
Copy link
Contributor

All of the custom warnings and exceptions will be in pint.exceptions now. This means that are easier to find/import, and also easier to use (since you can see which are already defined).

(the one exception is in noise_model.py, since some of the exceptions there require access to other functions defined in that module)

@dlakaplan dlakaplan linked an issue Sep 27, 2024 that may be closed by this pull request
@dlakaplan
Copy link
Contributor Author

Again, I'm not sure this is a good idea, but if we want it it's here.

@dlakaplan dlakaplan changed the title WIP: move exceptions to new module Move exceptions to new module Sep 27, 2024
@dlakaplan dlakaplan added needs discussion awaiting review This PR needs someone to review it so it can be merged labels Sep 27, 2024
Comment on lines +11 to +24
class DegeneracyWarning(UserWarning):
pass


class ConvergenceFailure(ValueError):
pass


class MaxiterReached(ConvergenceFailure):
pass


class StepProblem(ConvergenceFailure):
pass
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you please add docstrings explaining what each of these exceptions mean?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think I necessarily can, since I didn't write them. I could probably infer some from usage but that would take a while.

@abhisrkckl
Copy link
Contributor

I think this is a good idea, especially for avoiding circular imports and for improving readability.

@abhisrkckl
Copy link
Contributor

Please also add a CHANGELOG entry.

@abhisrkckl abhisrkckl merged commit 70f4a9b into nanograv:master Oct 17, 2024
7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
awaiting review This PR needs someone to review it so it can be merged needs discussion
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Define all exceptions in one place?
2 participants