Skip to content
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

fix: Incorrect 500 response for invalid requests #69

Merged
merged 2 commits into from
Mar 4, 2025

Conversation

rohitkrsoni
Copy link
Contributor

@rohitkrsoni rohitkrsoni commented Mar 4, 2025

Description

This PR is to fix incorrect error handling

Changes Made

Modified get_db() method so that it don't catches any exceptions and let fastapi handle the exceptions.
Changed to HTTPException whereever required

Related Issues

Fixes #65

Additional Notes

When we were handling Exception in get_db(), the HTTPException raised during serving the requests were getting handled by it. Because of the dependency injection, the db is initialised and the session is returned and when the request is served, the execution gets back to the except block and since there was an http exception raised, it was getting handled there.

@phoenixpereira phoenixpereira changed the title Fix 500 for invalid requests fix: Incorrect 500 response for invalid requests Mar 4, 2025
@phoenixpereira
Copy link
Member

@rohitkrsoni Please run uv run ruff format to fix the formatting issues.

@phoenixpereira phoenixpereira merged commit b74e81d into compsci-adl:main Mar 4, 2025
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

[Bug] Fix incorrect error handling
2 participants