Skip to content

fix: Throw OpenFeature errors for unsupported flag types#17

Draft
caitlynstocker wants to merge 2 commits into
mainfrom
cat/devex255/use-open-feature-errors
Draft

fix: Throw OpenFeature errors for unsupported flag types#17
caitlynstocker wants to merge 2 commits into
mainfrom
cat/devex255/use-open-feature-errors

Conversation

@caitlynstocker
Copy link
Copy Markdown
Contributor

@caitlynstocker caitlynstocker commented Jun 3, 2026

Background 🌇

At present, OctoToggle only supports boolean type feature flags, however the OpenFeature SDK also allows string, integer, number and object type feature flags. Currently when we attempt to solve for a non-boolean value, we throw a NotImplementedException, however OpenFeature provides us with error types which would give a more informative response.

What this? 🐦

This PR adjusts each of our functions which resolve a non-boolean feature flag to return:

  • FLAG_NOT_FOUND - in cases where the the slug cannot be matched with any existing toggles,
  • TYPE_MISMATCH - in cases where a correct slug is provided.

As part of this, I've converted the slug existence check in OctopusContext into a shared function which can be used by OctopusProvider.

Testing 🧪

  • TODO ACTUALLY DO THE MANUAL TESTING!

✅ Tested manually - both error types are throwing correctly and valid slugs can still be evaluated for.
✅ Unit tested with the tests included with this PR.

Considering that these error messages are not core functionality, unit tests are fine for now. We also considered adding specifications tests. However this would have required a separate schema and test class for the non-boolean cases, potentially causing us problems later if we're adding other flag types.

How to review? 🔍

💬 Check the comments on the code

Part of DEVEX-255

@caitlynstocker caitlynstocker changed the title Just the error logging with no tests fix: Throw OpenFeature errors for unsupported flag types Jun 3, 2026
this.client = null;
this.currentContext = context;
this.initialized = true;
}
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

This feels weird to me, but I don't know Java and I've had some long convos with Claude insisting it's correct.

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