Skip to content

Commit 74a8452

Browse files
committed
Return GENERAL error_code instead of PROVIDER_FATAL by default
1 parent c92f97d commit 74a8452

File tree

5 files changed

+6
-3
lines changed

5 files changed

+6
-3
lines changed

lib/datadog/open_feature/evaluation_engine.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ def fetch_value(flag_key:, default_value:, expected_type:, evaluation_context: n
3939
@telemetry.report(e, description: 'OpenFeature: Failed to fetch flag value')
4040

4141
ResolutionDetails.build_error(
42-
value: default_value, error_code: Ext::PROVIDER_FATAL, error_message: e.message
42+
value: default_value, error_code: Ext::GENERAL, error_message: e.message
4343
)
4444
end
4545

lib/datadog/open_feature/ext.rb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ module Ext
66
ERROR = 'ERROR'
77
INITIALIZING = 'INITIALIZING'
88
UNKNOWN_TYPE = 'UNKNOWN_TYPE'
9+
GENERAL = 'GENERAL'
910
PROVIDER_FATAL = 'PROVIDER_FATAL'
1011
PROVIDER_NOT_READY = 'PROVIDER_NOT_READY'
1112
end

lib/datadog/open_feature/provider.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,7 @@ def evaluate(flag_key, default_value:, expected_type:, evaluation_context:)
122122
rescue => e
123123
::OpenFeature::SDK::Provider::ResolutionDetails.new(
124124
value: default_value,
125-
error_code: Ext::PROVIDER_FATAL,
125+
error_code: Ext::GENERAL,
126126
error_message: e.message,
127127
reason: Ext::ERROR
128128
)

sig/datadog/open_feature/ext.rbs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@ module Datadog
77

88
UNKNOWN_TYPE: ::String
99

10+
GENERAL ::String
11+
1012
PROVIDER_FATAL: ::String
1113

1214
PROVIDER_NOT_READY: ::String

spec/datadog/open_feature/evaluation_engine_spec.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@
9696
expect(reporter).not_to receive(:report)
9797

9898
expect(result.value).to eq('fallback')
99-
expect(result.error_code).to eq('PROVIDER_FATAL')
99+
expect(result.error_code).to eq('GENERAL')
100100
expect(result.error_message).to eq('Crash')
101101
expect(result.reason).to eq('ERROR')
102102
end

0 commit comments

Comments
 (0)