Skip to content

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 moved this to In Progress in Courses API Mar 4, 2025
@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
@github-project-automation github-project-automation bot moved this from In Progress to Done in Courses API Mar 4, 2025
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