-
Notifications
You must be signed in to change notification settings - Fork 8
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
feat: query get_operation_records prints correct errors #554
base: master
Are you sure you want to change the base?
Conversation
This PR defines 2 queries in one. It makes code way more complicated and does not provide much value. Checking if the deployment exist may be a good idea but it should be done in it's own query. |
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.
Focus on resolving the issue mentioned by @sergkudinov on this PR:
When you changed to
.all()
here, theNoResultFound
exception is never raised.
Then, we could study how to raise a more specific Error.
As now we're doing 3 queries which seems a lot.
9940fdd
to
bcbb9ef
Compare
Opted for a very simple change, to through an error if no results are found and modified the message to incorporate the two possibilities. |
tdp/cli/queries.py
Outdated
f"Operation {operation_name} does not exist in deployment {deployment_id} or deployment {deployment_id} does not exist." | ||
) |
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.
You can even be more generic:
f"Operation {operation_name} does not exist in deployment {deployment_id} or deployment {deployment_id} does not exist." | |
) | |
f"Can't find operation {operation_name} for deployment {deployment_id}." | |
) from e |
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.
The whole point of the prolonged message was to state the two possible issues with the query, either the operation does not exist in the chosen deployment or the deployment itself does not exist. this message is more specific.
However I can change above the raise Exception
to raise NoResultsFound
which is also more specific.
Which issue(s) this PR fixes
Fixes #483
Additional comments
Modified the error handling to print the right messages
Agreements