Skip to content

Conversation

@leoromanovsky
Copy link
Contributor

Motivation

When integrating with OpenFeature, providers need to map Datadog's error conditions to OpenFeature's ErrorType enum. Currently, the IEvaluation.Error property is a string, requiring providers to do string matching to determine the error type.

Changes

  • Add ErrorCode enum with values that map to OpenFeature's ErrorType:
    • None, ProviderNotReady, FlagNotFound, TypeMismatch, ParseError, TargetingKeyMissing, InvalidContext, General
  • Add ErrorCode property to IEvaluation interface
  • Update Evaluation class to include ErrorCode parameter
  • Update FeatureFlagsEvaluator to set appropriate ErrorCode for each error case

Decisions

  • Keep both Error (string) and ErrorCode (enum): The string property is preserved for backwards compatibility and to allow custom error messages (e.g., exception details). This follows the same pattern as Java's OpenFeature integration which has both errorCode and errorMessage.

Add a structured ErrorCode enum that maps to OpenFeature's ErrorType,
allowing providers to programmatically check error conditions without
parsing error strings.

- Add ErrorCode enum with values: None, ProviderNotReady, FlagNotFound,
  TypeMismatch, ParseError, TargetingKeyMissing, InvalidContext, General
- Add ErrorCode property to IEvaluation interface
- Update Evaluation class to include ErrorCode
- Update FeatureFlagsEvaluator to set appropriate ErrorCode for each error case

The existing Error string property is preserved for backwards compatibility
and to allow custom error messages (e.g., exception details).
@github-actions github-actions bot added the area:tracer The core tracer library (Datadog.Trace, does not include OpenTracing, native code, or integrations) label Jan 27, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:tracer The core tracer library (Datadog.Trace, does not include OpenTracing, native code, or integrations)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants