dabla commented on code in PR #38707:
URL: https://github.com/apache/airflow/pull/38707#discussion_r1560920195


##########
airflow/providers/common/sql/hooks/sql.py:
##########
@@ -111,6 +112,15 @@ def fetch_one_handler(cursor) -> list[tuple] | None:
         return None
 
 
+@contextmanager
+def suppress_and_warn(*exceptions: type[BaseException]):
+    """Context manager that suppresses the given exceptions and logs a warning 
message."""
+    try:
+        yield
+    except exceptions as e:
+        warnings.warn(f"Exception suppressed: {e}\n{traceback.format_exc()}", 
category=UserWarning)
+
+

Review Comment:
   I'm willing to start a new PR regarding option 3, as I have a feeling you 
guys prefer that approach, but I don't know if I will be able to lead it but 
can try.  I would have done it as option 2 but 3 is also fine for me, as long 
as at the end we come to a cleaner and DRY solution.



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