Repository navigation
fix: Include the last data source error in provider error and stale events - #74
Open
kinyoklion wants to merge 2 commits into
Open
kinyoklion wants to merge 2 commits into
kinyoklion wants to merge 2 commits into
Conversation
…vents Co-Authored-By: rlamb@launchdarkly.com <4955475+kinyoklion@users.noreply.github.com>
Contributor
|
I'll fix CI failures and address comments from users with write access. I'll skip comments containing "(aside)".
|
Co-Authored-By: rlamb@launchdarkly.com <4955475+kinyoklion@users.noreply.github.com>
kinyoklion
marked this pull request as ready for review
October 16, 2026 21:22
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.
Requirements
Related issues
OFP requirements 4.2.3 / 4.2.4 (sdk-specs
OFP-openfeature-provider-behavior):STALE/ERRORevents MUST include the message of the last data source error, or a message describing the condition if it has none. The Java provider already does this.Describe the solution you've provided
Off(both inStatusChangeHandlerand theInitializeAsyncpre-check):PROVIDER_ERRORmessage and theLaunchDarklyProviderInitExceptionmessage now useDescribeLastError(status, ProviderShutdownMessage)instead of alwaysProviderShutdownMessage.Interrupted: previouslyLastError?.Message ?? "encountered an unknown error", so HTTP errors (which have noMessage) got the generic text; they now getErrorInfo.ToString()(e.g. kind + status code).Behavior is unchanged when there is no
LastError. Added tests for Off with an exception message, Off with an HTTP 401, Off with no error, and Interrupted with an HTTP 503.Describe alternatives you've considered
Always using
ErrorInfo.ToString()would also include the timestamp for exception-based errors;Messageis kept when present so existing Stale messages do not change.Additional context
Validated locally with
dotnet teston net8.0 (72 passed). Independent of the error-type PR (#73).Link to Devin session: https://app.devin.ai/sessions/929f5530882d40bc95e55391e97536d5
Open in Devin Desktop: https://app.devin.ai/desktop/session/929f5530882d40bc95e55391e97536d5?variant=devin
Requested by: @kinyoklion
SDK-3255
Note
Overview
Provider error and stale events now surface the LaunchDarkly data source’s last error instead of only generic shutdown or “unknown error” text, aligning with OpenFeature provider behavior (OFP 4.2.3 / 4.2.4).
A new
DescribeLastErrorhelper picksErrorInfo.Messagewhen present, otherwiseErrorInfo.ToString()(so HTTP failures without a message still describe status codes). That message is used forPROVIDER_ERROR/ init failures when the data source isOff(including theInitializeAsyncpre-check) and forPROVIDER_STALEwhen state isInterrupted. When there is noLastError, behavior stays the same via the existing fallback strings.Tests cover exception messages, HTTP 401/503 cases, and the default message when
LastErroris absent.Reviewed by Cursor Bugbot for commit 4324114. Bugbot is set up for automated code reviews on this repo. Configure here.