Repository: SAP/data-attribute-recommendation-python-sdk

Issue:
Expose validationMessage in DatasetValidationFailed
Having an error message as follows is not good enough:

```
sap.aibus.dar.client.exceptions.DatasetValidationFailed: Validation for Dataset '0992af67-bf6e-4b8c-b45c-76078e1e6eff' failed with status: 'INVALID_DATA'
```

We should additionally show the validationMessage from the DM API response or perhaps the entire API response.

Discussion:

Patch:
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 23cdc12..4859204 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -20,7 +20,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
 ### Fixed
 
 * Log message missing model deployment ID [#59]
+* Expose a Dataset's `validationMessage` in `DatasetValidationFailed` [#33], [#69]
 
+[#33]: https://github.com/SAP/data-attribute-recommendation-python-sdk/issues/33
 [#46]: https://github.com/SAP/data-attribute-recommendation-python-sdk/issues/46
 [#58]: https://github.com/SAP/data-attribute-recommendation-python-sdk/pull/58
 [#59]: https://github.com/SAP/data-attribute-recommendation-python-sdk/pull/59
@@ -28,6 +30,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
 [#63]: https://github.com/SAP/data-attribute-recommendation-python-sdk/pull/63
 [#64]: https://github.com/SAP/data-attribute-recommendation-python-sdk/pull/64
 [#66]: https://github.com/SAP/data-attribute-recommendation-python-sdk/pull/66
+[#69]: https://github.com/SAP/data-attribute-recommendation-python-sdk/pull/69
 
 ## [0.6.8]
 
diff --git a/sap/aibus/dar/client/data_manager_client.py b/sap/aibus/dar/client/data_manager_client.py
index 994a62b..32b7b9f 100644
--- a/sap/aibus/dar/client/data_manager_client.py
+++ b/sap/aibus/dar/client/data_manager_client.py
@@ -270,8 +270,11 @@ class DataManagerClient(BaseClientWithSession):
             raise new_exception from exception
 
         if self.is_dataset_validation_failed(response):
-            msg = "Validation for Dataset '{}' failed with status: '{}'".format(
-                response["id"], response["status"]
+            msg = (
+                "Validation for Dataset '{}' failed with status '{}' and"
+                " validation message: '{}'".format(
+                    response["id"], response["status"], response["validationMessage"]
+                )
             )
             self.log.error(msg)
             raise DatasetValidationFailed(msg)


Test patch:
diff --git a/tests/sap/aibus/dar/client/test_data_manager_client.py b/tests/sap/aibus/dar/client/test_data_manager_client.py
index 0208efd..08a398a 100644
--- a/tests/sap/aibus/dar/client/test_data_manager_client.py
+++ b/tests/sap/aibus/dar/client/test_data_manager_client.py
@@ -456,6 +456,9 @@ class TestDataManagerClientDatasetSchema:
 
             dataset_response = self._make_dataset_response(bad_dataset_state)
 
+            if bad_dataset_state == "VALIDATION_FAILED":
+                dataset_response["validationMessage"] = "Detailed Description"
+
             client.session.get_from_endpoint.return_value.json.side_effect = [
                 dataset_response
             ]
@@ -466,8 +469,10 @@ class TestDataManagerClientDatasetSchema:
                 )
             expected_message = (
                 "Validation for Dataset "
-                "'{}' failed with status: '{}'".format(
-                    dataset_response["id"], bad_dataset_state
+                "'{}' failed with status '{}' and validation message: '{}'".format(
+                    dataset_response["id"],
+                    bad_dataset_state,
+                    dataset_response["validationMessage"],
                 )
             )