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


##########
airflow/triggers/temporal.py:
##########
@@ -34,18 +35,29 @@ class DateTimeTrigger(BaseTrigger):
     The provided datetime MUST be in UTC.
     """
 
-    def __init__(self, moment: datetime.datetime):
+    def __init__(self, moment: datetime.datetime, soft_fail: bool = False):
         super().__init__()
         if not isinstance(moment, datetime.datetime):
-            raise TypeError(f"Expected datetime.datetime type for moment. Got 
{type(moment)}")
+            exc = TypeError(f"Expected datetime.datetime type for moment. Got 
{type(moment)}")
+            if soft_fail:
+                raise AirflowSkipException("Skipping due to soft_fail is set 
to True.") from exc
+            raise exc

Review Comment:
   Do we need to use `from` here? I feel it’d be more concise to combine the 
two error messages into `AirflowSkipException` instead.



##########
airflow/triggers/temporal.py:
##########
@@ -34,18 +35,29 @@ class DateTimeTrigger(BaseTrigger):
     The provided datetime MUST be in UTC.
     """
 
-    def __init__(self, moment: datetime.datetime):
+    def __init__(self, moment: datetime.datetime, soft_fail: bool = False):
         super().__init__()
         if not isinstance(moment, datetime.datetime):
-            raise TypeError(f"Expected datetime.datetime type for moment. Got 
{type(moment)}")
+            exc = TypeError(f"Expected datetime.datetime type for moment. Got 
{type(moment)}")
+            if soft_fail:
+                raise AirflowSkipException("Skipping due to soft_fail is set 
to True.") from exc
+            raise exc

Review Comment:
   Do we need to use `from` here? I feel it’d be more concise to combine the 
two error messages into `AirflowSkipException` instead.



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