Skip to content

Comments

feat: improve error handling in metrics and fetch toggles#264

Merged
chriswk merged 2 commits intoUnleash:mainfrom
gabrielduete:feat/improve-error-handling
Sep 9, 2025
Merged

feat: improve error handling in metrics and fetch toggles#264
chriswk merged 2 commits intoUnleash:mainfrom
gabrielduete:feat/improve-error-handling

Conversation

@gabrielduete
Copy link
Contributor

@gabrielduete gabrielduete commented Sep 4, 2025

About the changes

Closes #263 | Unleash/unleash#10620

Important files

src/index.ts

Discussion points

This pull request improves error event handling in the UnleashClient class to provide more context about where errors originate. Now, when an error is emitted, it includes a type field indicating the source of the error, making it easier to debug and handle errors appropriately.

Enhanced error event payloads:

  • Updated the onError handler in the Metrics instantiation to emit errors with a payload containing the error type ('metrics') and the error object, instead of just the error.
  • Modified error emission during toggle fetching to include the error type ('fetch-toggles') and the error object, instead of just the error.

@chriswk chriswk moved this from New to In Progress in Issues and PRs Sep 9, 2025
Copy link
Member

@chriswk chriswk left a comment

Choose a reason for hiding this comment

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

This makes sense to me. Thank you @gabrielduete . We'll get this merged and published.

@github-project-automation github-project-automation bot moved this from In Progress to Approved PRs in Issues and PRs Sep 9, 2025
@chriswk chriswk merged commit 1746b0a into Unleash:main Sep 9, 2025
3 checks passed
@github-project-automation github-project-automation bot moved this from Approved PRs to Done in Issues and PRs Sep 9, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

Expose error type for Unleash SDK error events

2 participants