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
Conversation
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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.