diff --git a/src/citrine/__version__.py b/src/citrine/__version__.py index f5752882d..0419a93d2 100644 --- a/src/citrine/__version__.py +++ b/src/citrine/__version__.py @@ -1 +1 @@ -__version__ = "5.3.0" +__version__ = "5.3.1" diff --git a/src/citrine/resources/ingestion.py b/src/citrine/resources/ingestion.py index 08ce0d994..4404d0b1c 100644 --- a/src/citrine/resources/ingestion.py +++ b/src/citrine/resources/ingestion.py @@ -74,11 +74,18 @@ class IngestionErrorLevel(BaseEnumeration): INFO = "info" +class _IngestionErrorTypeProperty(properties.Enumeration): + """Maps error types this SDK doesn't know yet to UNKNOWN_ERROR, so the trace's msg survives.""" + + def _deserialize(self, value: str) -> IngestionErrorType: + return IngestionErrorType.from_str(value) or IngestionErrorType.UNKNOWN_ERROR + + class IngestionErrorTrace(Resource["IngestionErrorTrace"]): """[ALPHA] Detailed information about an ingestion issue.""" family = properties.Enumeration(IngestionErrorFamily, "family") - error_type = properties.Enumeration(IngestionErrorType, "error_type") + error_type = _IngestionErrorTypeProperty(IngestionErrorType, "error_type") level = properties.Enumeration(IngestionErrorLevel, "level") msg = properties.String("msg") dataset_file_id = properties.Optional(properties.UUID(), "dataset_file_id", default=None) diff --git a/tests/resources/test_ingestion.py b/tests/resources/test_ingestion.py index 7fede465b..85798fbae 100644 --- a/tests/resources/test_ingestion.py +++ b/tests/resources/test_ingestion.py @@ -396,3 +396,20 @@ def test_status_parses_server_error_types(error_type): ) ) assert status.errors[0].error_type == IngestionErrorType(error_type) + + +def test_status_falls_back_on_unknown_error_type(): + status = IngestionStatus.build( + IngestionStatusResponseDataFactory( + errors=[ + { + "family": "data", + "error_type": "some_future_error", + "level": "error", + "msg": "A server-only ingestion error", + } + ] + ) + ) + assert status.errors[0].error_type == IngestionErrorType.UNKNOWN_ERROR + assert status.errors[0].msg == "A server-only ingestion error"