Repository navigation
fix: Include the HTTP status in exceptions on evaluation reasons - #291
Merged
Merged
Conversation
The exception reaches callers through EvaluationReason::getException(). Its message and code were empty, so the HTTP status was only visible through the internal status property.
jsonbailey
approved these changes
Nov 10, 2026
keelerm84
pushed a commit
that referenced
this pull request
Nov 10, 2026
🤖 I have created a release *beep* *boop* --- ## [6.12.1](6.12.0...6.12.1) (2026-11-10) ### Bug Fixes * Include the big segments status on evaluation reasons for failed evaluations ([#292](#292)) ([2f2b1fe](2f2b1fe)) * Include the HTTP status in exceptions on evaluation reasons ([#291](#291)) ([52d3303](52d3303)) * Make TestData valueForAll return its value when targeting is off ([#288](#288)) ([b8a9522](b8a9522)) * Prevent allFlagsState from throwing when retrieving flags fails ([#294](#294)) ([2b65bf2](2b65bf2)) --- This PR was generated with [Release Please](https://github.com/googleapis/release-please). See [documentation](https://github.com/googleapis/release-please#release-please). Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
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.
Summary
When an HTTP 401 or 403 stops flag evaluation,
EvaluationReason::getException()returns an exception for the failed request. That exception had an empty message and a code of0, so callers could not see which status caused the error. It now has the messageHTTP error <status>, and its code is the status.The exception does not chain the underlying Guzzle exception, because that exception's request carries the
Authorizationheader with the SDK key.Note
Overview
UnrecoverableHTTPStatusExceptionnow sets a clearHTTP error <status>message and uses the HTTP status as the exception code (in addition to the existingstatusproperty), so evaluation reasons expose actionable status info instead of an empty message and code0.The constructor does not chain the underlying Guzzle exception, because that previous exception can retain the request (including the Authorization header with the SDK key).
A new
LDClientTestcase drives a mocked Guzzle feature requester through 401/403 responses and asserts message, code,status, andgetPrevious() === null.Reviewed by Cursor Bugbot for commit f3e9c90. Bugbot is set up for automated code reviews on this repo. Configure here.