Skip to content

feat: add ability to suppress error logs#1248

Closed
joker23 wants to merge 1 commit intomainfrom
skz/sdk-1998/error-suppression
Closed

feat: add ability to suppress error logs#1248
joker23 wants to merge 1 commit intomainfrom
skz/sdk-1998/error-suppression

Conversation

@joker23
Copy link
Copy Markdown
Contributor

@joker23 joker23 commented Apr 6, 2026

This PR will add the ability to suppress error logs using the same technique as some server sdks:

Now, if developers subscribes to the error event, then they will no longer see error logs. Instead
they are expected to handle errors themselves in the event callback.

basically doing the same thing as the old browser sdk


Note

Medium Risk
Changes how SDK errors are surfaced (emit vs log) across identify/streaming/polling and evaluation paths; risk is primarily behavioral for consumers who relied on default logger output or listener counts.

Overview
Adds opt-in suppression of internal error logging: errors are now logged only when no error listeners are registered, and otherwise are emitted to user handlers.

This introduces LDEmitter.maybeReportError and routes key error paths (invalid context in identify, streaming/polling failures in DataManager, and wrong-type flag evaluations) through it. The default LDClientImpl-level error listener is removed, and tests are updated/added to verify listener-count behavior and the new log-vs-emit semantics.

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


Open with Devin

@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Apr 6, 2026

@launchdarkly/js-sdk-common size report
This is the brotli compressed size of the ESM build.
Compressed size: 25661 bytes
Compressed size limit: 29000
Uncompressed size: 126143 bytes

@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Apr 6, 2026

@launchdarkly/browser size report
This is the brotli compressed size of the ESM build.
Compressed size: 179521 bytes
Compressed size limit: 200000
Uncompressed size: 829331 bytes

@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Apr 6, 2026

@launchdarkly/js-client-sdk size report
This is the brotli compressed size of the ESM build.
Compressed size: 31553 bytes
Compressed size limit: 34000
Uncompressed size: 112148 bytes

@joker23 joker23 force-pushed the skz/sdk-1998/error-suppression branch 2 times, most recently from 0020e0d to 9e28f66 Compare April 6, 2026 23:42
@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Apr 6, 2026

@launchdarkly/js-client-sdk-common size report
This is the brotli compressed size of the ESM build.
Compressed size: 37131 bytes
Compressed size limit: 38000
Uncompressed size: 203288 bytes

@joker23 joker23 force-pushed the skz/sdk-1998/error-suppression branch from 9e28f66 to 301c447 Compare April 7, 2026 13:51
@joker23
Copy link
Copy Markdown
Contributor Author

joker23 commented Apr 7, 2026

@cursor review

Copy link
Copy Markdown

@cursor cursor bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ Bugbot reviewed your changes and found no new issues!

Comment @cursor review or bugbot run to trigger another review on this PR

Reviewed by Cursor Bugbot for commit 301c447. Configure here.

@joker23 joker23 marked this pull request as ready for review April 7, 2026 16:42
@joker23 joker23 requested a review from a team as a code owner April 7, 2026 16:42
Copy link
Copy Markdown
Contributor

@devin-ai-integration devin-ai-integration bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ Devin Review: No Issues Found

Devin Review analyzed this PR and found no potential bugs to report.

View in Devin Review to see 4 additional findings.

Open in Devin Review

@joker23
Copy link
Copy Markdown
Contributor Author

joker23 commented Apr 7, 2026

Closing as we will delegate to overriding the logger

@joker23 joker23 closed this Apr 7, 2026
@joker23 joker23 deleted the skz/sdk-1998/error-suppression branch April 7, 2026 16:51
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.

1 participant