Skip to content

feat: query get_operation_records prints correct errors #554

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

Closed
wants to merge 2 commits into from

Conversation

SteBaum
Copy link
Contributor

@SteBaum SteBaum commented Feb 20, 2024

Which issue(s) this PR fixes

Fixes #483

Additional comments

Modified the error handling to print the right messages

Agreements

@SteBaum SteBaum self-assigned this Feb 20, 2024
@SteBaum SteBaum requested a review from PaulFarault February 20, 2024 10:45
@PaulFarault
Copy link
Contributor

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.

Copy link
Contributor

@PaulFarault PaulFarault left a 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, the NoResultFound 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.

@SteBaum SteBaum force-pushed the 483-tdp-browse-print branch from 9940fdd to bcbb9ef Compare April 2, 2024 08:59
@SteBaum SteBaum requested a review from PaulFarault April 2, 2024 09:01
@SteBaum
Copy link
Contributor Author

SteBaum commented Apr 2, 2024

Opted for a very simple change, to through an error if no results are found and modified the message to incorporate the two possibilities.

@TOSIT-IO TOSIT-IO deleted a comment from PaulFarault Apr 2, 2024
Comment on lines 232 to 233
f"Operation {operation_name} does not exist in deployment {deployment_id} or deployment {deployment_id} does not exist."
)
Copy link
Contributor

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:

Suggested change
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

Copy link
Contributor Author

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.

@SteBaum SteBaum requested a review from PaulFarault April 4, 2024 06:47
@PaulFarault PaulFarault marked this pull request as draft June 10, 2024 08:53
@PaulFarault PaulFarault closed this Dec 3, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

tdp browse prints wrong info with wrong parameters
2 participants