svdimchenko commented on code in PR #31595:
URL: https://github.com/apache/airflow/pull/31595#discussion_r1209287092


##########
airflow/providers/cncf/kubernetes/operators/pod.py:
##########
@@ -696,10 +698,11 @@ def cleanup(self, pod: k8s.V1Pod, remote_pod: k8s.V1Pod):
                         f"Pod {pod and pod.metadata.name} returned exit code "
                         f"{self.skip_on_exit_code}. Skipping."
                     )
-            raise AirflowException(
-                f"Pod {pod and pod.metadata.name} returned a 
failure:\n{error_message}\n"
-                f"remote_pod: {remote_pod}"
-            )
+            raise AirflowException('\n'.join(filter(None, [
+                f"Pod {pod and pod.metadata.name} returned a failure.",
+                error_message,

Review Comment:
   @pankajkoti the join symbol is `\n` so that all messages will be logged in 
new line.
   Now if the value is not set it will be filtered out from exception message, 
so that same behaviour will be achieved but without explicit set to an empty 
string



-- 
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