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


##########
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:
   Ok. then what we should do if it is used in several providers - since we 
have no `common.util` - do you propose to copy it simply ? Less DRY, less 
coupling, more copy&paste. Or any other idea?



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