Skip to content

Standardize FlagNotFound error #42

@Zaimwa9

Description

@Zaimwa9

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) 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 to use the new error kind instead of string matching

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions