Repository navigation
Fix middleware DB error handling to return proper 503 instead of raw 500 - #5592
Open
WeiQuan0605 wants to merge 3 commits into
Open
WeiQuan0605 wants to merge 3 commits into
WeiQuan0605 wants to merge 3 commits into
Conversation
* Also fixes a Content-Type: trailing colon typo in SecurityContextSetter's UAA 502 response.
WeiQuan0605
marked this pull request as ready for review
October 27, 2026 15:30
serdarozerr
reviewed
Oct 28, 2026
Addresses reviewer suggestion to follow the pattern in TooManyRequests mixin.
…unner_spec Puma::Server.new stub was not reliably intercepted when setup_metrics spawned a Thread, causing an ArgumentError in CI.
This branch has not been deployed
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.
A short explanation of the proposed change:
When the database is unavailable, the CC API was returning a raw 500 Internal Server Error with no JSON body instead of a structured error response. This happened because UserContextSetter middleware runs outside the Rails/Sinatra error handling stack, database errors raised there never reach rescue_from in the application controllers.
This PR:
An explanation of the use cases your change solves
During a database failover or outage, clients receive a proper 503 with a structured CF-ServiceUnavailable JSON body and a correlation ID (X-Vcap-Request-ID) instead of a raw 500 with no body
I have reviewed the contributing guide
I have viewed, signed, and submitted the Contributor License Agreement
I have made this pull request to the
mainbranchI have run all the unit tests using
bundle exec rakeI have run CF Acceptance Tests