-
Notifications
You must be signed in to change notification settings - Fork 15
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
Add comments/docstrings to exceptions #1873
Add comments/docstrings to exceptions #1873
Conversation
Coverage reportClick to see where and how coverage changed
This report was generated by python-coverage-comment-action |
I'm still trying to understand what we want the errors to achieve. At the moment they're a bit of a mishmash. For example, On the other hand, we have Then we have Finding it difficult to nail a description for some of these error classes as it's not always clear what they are intended to capture |
It's totally fine for you to redesign the error names and/or inheritance structure to make more sense. I think we want things to adhere to the following guidelines:
Anything else you'd add to this @JimMadge ? |
@craddm is this still being worked on? |
Yes - sorry, it's been bumped down the priority list a few times. I'll get back to it shortly. |
No problem - just checking that you weren't waiting for review. |
Um, what happened here @craddm ? |
I tried to update it inline with develop, and apparently it went horribly wrong |
Yes, I've decided I'm happy leaving |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good.
I'm happy to keep DataSafeHaven{Value,Type}Error
. Do we catch them anywhere?
If we don't I can see that we might want to in the future.
Looking at commands files, I think there are places where we need to replace raise DataSafeHaven*
with
logger.critical(message)
Typer.Exit(1)
@craddm could you open an issue for that unless you want to fix it here?
Co-authored-by: Jim Madge <jim+github@jmadge.com>
Co-authored-by: Jim Madge <jim+github@jmadge.com>
Co-authored-by: Jim Madge <jim+github@jmadge.com>
Co-authored-by: Jim Madge <jim+github@jmadge.com>
Co-authored-by: Jim Madge <jim+github@jmadge.com>
Co-authored-by: Jim Madge <jim+github@jmadge.com>
Co-authored-by: Jim Madge <jim+github@jmadge.com>
@craddm Are you looking to fix all of the exceptions in commands here? |
Possibly - am I on the right track? |
Yes, you just need to do something similar for every |
I think I've got all the relevant ones now. There are some I've left alone as I think we don't want to exit at the point they occur, but could be wrong. |
One thing I was unsure about was when I needed to decode |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@craddm Are there any more raise
s in data_safe_haven/commands/*.py
functions? I think all of those should be replaces with a message and Typer.Exit
to gracefully end the program.
There are some nested I interpret this as the inner exception being caught by the outer exception, and thus there's no need to |
@craddm Ready to merge? |
✅ Checklist
Enable foobar integration
rather than515 foobar
).develop
.'[WIP]'
to the title if needed (if you're not yet ready to merge).Adds descriptive comments and/or docstrings to exceptions.
Also checks consistency of usage across the codebase.
🌂 Related issues
Closes #1518
🔬 Tests