Skip to content

fix: Include the HTTP status in exceptions on evaluation reasons - #291

Merged
keelerm84 merged 1 commit into
mainfrom
mk/SDK-3517/http-exception-message
Nov 10, 2026
Merged

keelerm84 merged 1 commit into
mainfrom
mk/SDK-3517/http-exception-message

Conversation

@keelerm84

@keelerm84 keelerm84 commented Nov 9, 2026 •

Copy link
Copy Markdown
Member

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 of 0, so callers could not see which status caused the error. It now has the message HTTP error <status>, and its code is the status.

The exception does not chain the underlying Guzzle exception, because that exception's request carries the Authorization header with the SDK key.


Note

Overview
UnrecoverableHTTPStatusException now sets a clear HTTP error <status> message and uses the HTTP status as the exception code (in addition to the existing status property), so evaluation reasons expose actionable status info instead of an empty message and code 0.

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 LDClientTest case drives a mocked Guzzle feature requester through 401/403 responses and asserts message, code, status, and getPrevious() === null.

Reviewed by Cursor Bugbot for commit f3e9c90. Bugbot is set up for automated code reviews on this repo. Configure here.

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.
@keelerm84
keelerm84 marked this pull request as ready for review November 9, 2026 18:16
@keelerm84
keelerm84 requested a review from a team as a code owner November 9, 2026 18:16
@keelerm84
keelerm84 requested a review from kinyoklion November 9, 2026 20:33
@keelerm84
keelerm84 merged commit 52d3303 into main Nov 10, 2026
13 checks passed
@keelerm84
keelerm84 deleted the mk/SDK-3517/http-exception-message branch November 10, 2026 15:29
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>
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.

2 participants