Skip to content

Fixes #357 by serializing MontageErrors natively in MessageMiddleware and hardening the round_creation API contract.#415

Open
ayushshukla1807 wants to merge 1 commit intohatnote:masterfrom
ayushshukla1807:fix-round-creation-500-cors
Open

Fixes #357 by serializing MontageErrors natively in MessageMiddleware and hardening the round_creation API contract.#415
ayushshukla1807 wants to merge 1 commit intohatnote:masterfrom
ayushshukla1807:fix-round-creation-500-cors

Conversation

@ayushshukla1807
Copy link
Copy Markdown

@ayushshukla1807 ayushshukla1807 commented Mar 21, 2026

Missing validation in round creation was causing the backend to crash with an AttributeError. Because the crash happened deep in the stack, it bypassed the CORS middleware, resulting in a confusing "Network Error" on the frontend instead of a clear validation message.

Changes:

Added null-guards for request_dict in the admin endpoints.
Updated MessageMiddleware to catch and serialize MontageError as proper JSON responses.
Ensures that validation errors always return a 400 status with a descriptive message rather than a 500.

This commit patches the admin_endpoints validation to gracefully handle empty POST bodies, and modifies MessageMiddleware to intercept MontageErrors so they correctly return 400 Bad Request JSON instead of bypassing CORS headers. Resolves Issue hatnote#357.
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