Skip to content

fix: Handle invalid course code format gracefully - #59

Merged
LonelyGuy-SE1 merged 1 commit into
mainfrom
seer/fix/handle-invalid-course-code
Aug 4, 2026
Merged

fix: Handle invalid course code format gracefully#59
LonelyGuy-SE1 merged 1 commit into
mainfrom
seer/fix/handle-invalid-course-code

Conversation

@sentry

@sentry sentry Bot commented Jul 28, 2026

Copy link
Copy Markdown
Contributor

Previously, submitting a course code with an invalid format (e.g., missing a required suffix like 'UE25CS301') would cause a ValueError in parse_course_code. This error was uncaught in the /api/submissions endpoint, leading to an unhandled 500 Internal Server Error.

This change wraps the call to parse_course_code in backend/app/routes/submissions.py within a try...except ValueError block. If a ValueError occurs, an HTTPException with a 400 Bad Request status code is now raised, providing a more appropriate and user-friendly error response to the client. The original exception is chained using from exc for better debugging consistency.

Fixes PYTHON-FASTAPI-1G

@vercel

vercel Bot commented Jul 28, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
pesu-curriculum-automation Ready Ready Preview, Comment Jul 28, 2026 10:40pm

@LonelyGuy-SE1
LonelyGuy-SE1 merged commit 36cf5a2 into main Aug 4, 2026
7 checks passed
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.

1 participant