Skip to content

Commit 20eada9

Browse files
fix: Map the WRONG_TYPE error kind to TYPE_MISMATCH
Co-Authored-By: rlamb@launchdarkly.com <4955475+kinyoklion@users.noreply.github.com>
1 parent 9395775 commit 20eada9

2 files changed

Lines changed: 3 additions & 0 deletions

File tree

ld_openfeature/impl/details_converter.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,8 @@ def __error_kind_to_code(error_kind: Optional[str]) -> ErrorCode:
100100
return ErrorCode.PARSE_ERROR
101101
elif error_kind == 'USER_NOT_SPECIFIED':
102102
return ErrorCode.TARGETING_KEY_MISSING
103+
elif error_kind == 'WRONG_TYPE':
104+
return ErrorCode.TYPE_MISMATCH
103105

104106
# NOTE: EXCEPTION_ERROR intentionally omitted
105107

tests/impl/test_details_converter.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ def test_ld_to_openfeature_kind_mappings(detail_kind: str, reason: Union[str, Re
3838
pytest.param('FLAG_NOT_FOUND', ErrorCode.FLAG_NOT_FOUND),
3939
pytest.param('MALFORMED_FLAG', ErrorCode.PARSE_ERROR),
4040
pytest.param('USER_NOT_SPECIFIED', ErrorCode.TARGETING_KEY_MISSING),
41+
pytest.param('WRONG_TYPE', ErrorCode.TYPE_MISMATCH),
4142
pytest.param('EXCEPTION_ERROR', ErrorCode.GENERAL),
4243
],
4344
)

0 commit comments

Comments
 (0)