Skip to content

Add meaningful exception handling, report errors #38

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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

ponyisi
Copy link
Contributor

@ponyisi ponyisi commented Aug 4, 2025

Call a new ServiceX endpoint if the DID finder throws an exception. Provide some exceptions to cover use cases.

Copy link

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR adds comprehensive exception handling to the ServiceX DID finder library. It introduces a new error reporting mechanism and creates specific exception types for different failure scenarios.

  • Introduces new custom exception types for specific DID finding failures
  • Adds error reporting to ServiceX through a new /error endpoint
  • Updates the main DID finder task to catch exceptions and report them appropriately

Reviewed Changes

Copilot reviewed 6 out of 6 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
src/servicex_did_finder_lib/exceptions.py Defines new exception hierarchy with specific error types for DID finding failures
src/servicex_did_finder_lib/servicex_adaptor.py Adds new put_fileset_error method and convenience put_file_add method
src/servicex_did_finder_lib/did_finder_app.py Updates exception handling to catch and report errors via new error endpoint
src/servicex_did_finder_lib/communication.py Updates type hint for UserDIDHandler return type
tests/servicex_did_finder_lib_tests/test_servicex_adaptor.py Adds tests for the new error reporting functionality
tests/servicex_did_finder_lib_tests/test_did_finder_app.py Updates tests to cover new exception handling behavior

Copy link
Contributor

@gordonwatts gordonwatts left a comment

Choose a reason for hiding this comment

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

This seems great - the one comment I had was the retry was coded instead of using a well tested library.

def put_fileset_error(self, summary):
success = False
attempts = 0
while not success and attempts < MAX_RETRIES:
Copy link
Contributor

Choose a reason for hiding this comment

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

Should this be using a retry decorator instead?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes but if prefer to do that coherently with the other function in another PR.

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.

2 participants