Skip to content

Commit aca7df4

Browse files
update: improve error logging for CMAB decision fetch failures
1 parent fcdad1f commit aca7df4

File tree

2 files changed

+5
-6
lines changed

2 files changed

+5
-6
lines changed

optimizely/decision_service.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -185,11 +185,10 @@ def _get_decision_for_cmab_experiment(
185185
}
186186
except Exception as e:
187187
error_message = Errors.CMAB_FETCH_FAILED_DETAILED.format(
188-
experiment.key,
189-
str(e)
188+
experiment.key
190189
)
191190
if self.logger:
192-
self.logger.error(error_message)
191+
self.logger.error(f'{error_message} {str(e)}')
193192
return {
194193
"error": True,
195194
"result": None,

optimizely/helpers/enums.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -127,9 +127,9 @@ class Errors:
127127
ODP_INVALID_DATA: Final = 'ODP data is not valid.'
128128
ODP_INVALID_ACTION: Final = 'ODP action is not valid (cannot be empty).'
129129
MISSING_SDK_KEY: Final = 'SDK key not provided/cannot be found in the datafile.'
130-
CMAB_FETCH_FAILED: Final = 'CMAB decision fetch failed with status: {}'
131-
INVALID_CMAB_FETCH_RESPONSE: Final = 'Invalid CMAB fetch response'
132-
CMAB_FETCH_FAILED_DETAILED: Final = 'Failed to fetch CMAB decision for experiment key "{}" - {}'
130+
CMAB_FETCH_FAILED: Final = 'CMAB decision fetch failed with status: {}.'
131+
INVALID_CMAB_FETCH_RESPONSE: Final = 'Invalid CMAB fetch response.'
132+
CMAB_FETCH_FAILED_DETAILED: Final = 'Failed to fetch CMAB data for experiment {}.'
133133

134134

135135
class ForcedDecisionLogs:

0 commit comments

Comments
 (0)