Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Have a way to differenciate errors due to requests errors vs missing flags #65

Open
AdrianB-sovo opened this issue Oct 18, 2023 · 3 comments
Assignees

Comments

@AdrianB-sovo
Copy link

When doing:

flags = flagsmith.get_environment_flags()
environment_flags.is_feature_enabled("foo")
  • If the feature flag does not exist, the following error is raised:
    FlagsmithClientError("Feature does not exist: <my_feature>")
  • If the environment failed to do an API request, the following error is raised:
    FlagsmithClientError("Feature does not exist: <my_feature>")

I would like to raise different alerts in those cases, because the fix to the problems are not the same (i.e., waiting for it to resolve itself vs adding the flag or removing the code using the flag).

Could we have a way to differentiate them?

Suggestions

  • Flags could have an attribute to store the fact that the Flags were created following a FlagsmithAPIError, then, different errors could be raised in Flags.get_flag() using this attribute.

or

  • The default_flag_handler() could have a parameter that would indicate the type of error.
@matthewelwell
Copy link
Contributor

Hi @AdrianB-sovo, thanks for this. It's an interesting point and I certainly understand the request. As per your first suggestion, I think that adding a parameter to the Flags object to indicate if the request to the API was successful or not would be the best way to solve this.

Would you be up for submitting a PR for this? Otherwise we will add this to our backlog.

@AdrianB-sovo
Copy link
Author

Hi @matthewelwell 🙂, I don't think I'll have time to work on a PR for this.

@matthewelwell
Copy link
Contributor

@AdrianB-sovo no problem! I will include it in our backlog.

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

No branches or pull requests

3 participants