Skip to content

fix: catch exceptions for get_table#3

Merged
mekhlakapoor merged 4 commits into
mainfrom
fix-404-error-handling
Feb 4, 2026
Merged

fix: catch exceptions for get_table#3
mekhlakapoor merged 4 commits into
mainfrom
fix-404-error-handling

Conversation

@mekhlakapoor

@mekhlakapoor mekhlakapoor commented Feb 4, 2026

Copy link
Copy Markdown
Collaborator

The flow was updated to properly propagate an error. This PR updates the get_table route toraise when an exception is caught NotFoundException is caught.

Question:

  • Is this handling necessary? None of our other microservices are explicitly handling errors.
  • Other microservices return [] when queried "badly" (ex: smartsheet/perfusion/bad" returns []) so first pass of this PR caught the NotFoundException and returns an empty list. However handling it like so (especially for fetching a table) is ambiguous
{3EA99B3B-B41B-43B0-937B-5F455D4D5E15}

api_version=api_version, body=body, _request_timeout=10
)
except allen_powerplatform_client.exceptions.NotFoundException:
api_response = []

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Returning [] could be ambiguous for cases where table exists but is empty.

Instead of only handling NotFoundException, would it make sense to catch all PowerPlatform exceptions?

except allen_powerplatform_client.exceptions.ApiException as e:
    raise HTTPException(
        status_code=e.status,
        detail=e.reason,
    )

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

I agree that it could be ambiguous. However none of our other services have explicit error handling / raise HTTPExceptions in the server routes. I believe we did this on purpose to keep things simple but I may be misremembering.

I've updated the branch to propagate PowerPlatform exceptions because I do agree that having the actual exceptions could be useful but would be open to your thoughts @jtyoung84

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

That should be fine.

@mekhlakapoor mekhlakapoor marked this pull request as draft February 4, 2026 22:52
@mekhlakapoor mekhlakapoor changed the title fix: 404 error returns empty response fix: catch exceptions for get_table Feb 4, 2026
@mekhlakapoor mekhlakapoor marked this pull request as ready for review February 4, 2026 23:23
@mekhlakapoor mekhlakapoor merged commit ea16769 into main Feb 4, 2026
3 checks passed
@mekhlakapoor mekhlakapoor deleted the fix-404-error-handling branch May 11, 2026 17:11
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.

3 participants