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

[FEATURE] ResolutionDetails improved typing for error cases. #246

Open
toddbaert opened this issue Sep 29, 2022 · 2 comments
Open

[FEATURE] ResolutionDetails improved typing for error cases. #246

toddbaert opened this issue Sep 29, 2022 · 2 comments
Labels
enhancement New feature or request

Comments

@toddbaert
Copy link
Member

Requirements

Improve typings of EvaluationDetails and ResolutionDetails by forcing the addition of errorCode if reason = ERROR.

@mowies
Copy link
Member

mowies commented Mar 27, 2023

shouldn't this be the other way around? if error code is error, then you need a reason for the error code?

@toddbaert
Copy link
Member Author

toddbaert commented Mar 28, 2023

@mowies I see why you'd think that, but in the semantics of the SDK, the REASON field is not a REASON for an error. It's the reason that the resolution proceeded the way it did.

For example, if a flag evaluated to true because it's defined statically as true, than the provider can set the REASON to STATIC. If the flag evaluated to true because a certain targeting rule was hit, that would be TARGETING_MATCH. See the table from the spec here. REASONs are something like HTTP status codes, which can indicate both success and error, but their main purpose is to communicate the why. Similarly to HTTP status code, they can be extended, but a limited list of pre-defined reasons is shipped with SDKs.

This issue is to force the population of errorCode if Reason === Error, which is something the spec recommends: https://docs.openfeature.dev/docs/specification/sections/flag-evaluation/#requirement-148

@toddbaert toddbaert reopened this Mar 28, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants