Flagsmith / Flagsmith/flagsmith-rust-client

Standardise FlagNotFound error

Open
#42 0 comments 0 reactions 0 assignees View on GitHub
enhancement
Dominant language
Rust
Stars
8
Forks
7
Avg merge
1d 16h
Merged PRs (30d)
3

Description

**Problem**
Currently, when a flag key isn't found, the SDK returns a generic FlagsmithAPIError with the message `API returned invalid response`.
This forces consumers (cf OpenFeature [crate](https://github.com/open-feature/rust-sdk-contrib/)) to rely on fragile string matching to detect this case.

**Proposed solution**
Add a FlagNotFound variant to ErrorKind and return it from Flags::get_flag when the key doesn't exist in the HashMap.

**Requirements**

- [ ] Add FlagNotFound error kind and return it from Flags::get_flag
- [ ] Update the [OpenFeature provider](https://github.com/open-feature/rust-sdk-contrib) to use the new error kind instead of string matching

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.