uranusjr commented on code in PR #27797:
URL: https://github.com/apache/airflow/pull/27797#discussion_r1040774539


##########
airflow/exceptions.py:
##########
@@ -368,3 +368,11 @@ class 
AirflowProviderDeprecationWarning(DeprecationWarning):
 
     deprecated_provider_since: str | None = None
     "Indicates the provider version that started raising this deprecation 
warning"
+
+
+class DeserializingResultError(AirflowException):
+    """ Raised when an error is encountered while a pickling library 
deserializes a pickle file"""
+
+    def __str__(self):
+        return "Error deserializing result. Note that result deserialization 
\n" \
+               "is not supported across major Python versions."

Review Comment:
   ```suggestion
           return (
               "Error deserializing result. Note that result deserialization "
               "is not supported across major Python versions."
           )
   ```



##########
airflow/operators/python.py:
##########
@@ -372,11 +373,7 @@ def _read_result(self, path: Path):
         try:
             return self.pickling_library.loads(path.read_bytes())
         except ValueError:
-            self.log.error(
-                "Error deserializing result. Note that result deserialization "
-                "is not supported across major Python versions."
-            )
-            raise
+            raise DeserializingResultError

Review Comment:
   ```suggestion
               raise DeserializingResultError from None
   ```



##########
airflow/exceptions.py:
##########
@@ -368,3 +368,11 @@ class 
AirflowProviderDeprecationWarning(DeprecationWarning):
 
     deprecated_provider_since: str | None = None
     "Indicates the provider version that started raising this deprecation 
warning"
+
+
+class DeserializingResultError(AirflowException):

Review Comment:
   ```suggestion
   class DeserializingResultError(ValueError):
   ```



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to