Skip to content

feat: added isOn must-variant or default#12

Merged
petruki merged 1 commit into
masterfrom
staging
May 18, 2026
Merged

feat: added isOn must-variant or default#12
petruki merged 1 commit into
masterfrom
staging

Conversation

@petruki
Copy link
Copy Markdown
Member

@petruki petruki commented May 18, 2026

This pull request introduces new "must-variant" methods to the Switcher API Go SDK, which simplify error handling by allowing default values to be returned when errors occur. The documentation and tests have been updated to cover these new methods and their usage.

New must-variant methods for error handling:

  • Added IsOnOrDefault and IsOnWithDetailsOrDefault methods to the Switcher struct, allowing callers to specify default values that are returned if an error occurs. These methods also notify the client's error callback when available.

Documentation updates:

  • Updated README.md to document the new must-variant methods, including usage examples and error handling guidance. [1] [2]

Testing improvements:

  • Added new tests in switcher_test.go to verify the behavior of the must-variant methods, including cases for both valid and invalid switcher configurations and error callback notifications.
  • Added a test for validation errors when the switcher is invalid.
  • Imported the time package to support new test scenarios.

@petruki petruki self-assigned this May 18, 2026
@petruki petruki added documentation Improvements or additions to documentation enhancement New feature or request labels May 18, 2026
@sonarqubecloud
Copy link
Copy Markdown

@petruki petruki merged commit 9ffbb31 into master May 18, 2026
7 checks passed
@petruki petruki deleted the staging branch May 18, 2026 20:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentation Improvements or additions to documentation enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant