open-feature / python-sdk

Python SDK for OpenFeature
https://openfeature.dev
Apache License 2.0
48 stars 16 forks source link

Ensure error hooks are run when provider returns FlagResolutionDetails with error code #290

Closed federicobond closed 6 months ago

federicobond commented 6 months ago

Currently, in error situations, it's possible for providers to return FlagResolutionDetails objects with errors set, OR throw. However, the SDK only runs the error hooks when an error is thrown.

It should either be impossible to return an object indicating an error (we'd need a new type) or the SDK should check the returned object and run the error hooks if an error is indicated.

See https://github.com/open-feature/python-sdk/blob/3f336b3a248dd8e75e162870d26a4b97c61f2ff6/openfeature/client.py#L378