potiuk commented on code in PR #38707:
URL: https://github.com/apache/airflow/pull/38707#discussion_r1561336492
##########
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:
We can definitely start with copying and the "common.utils" might come later
- I am fine wit poison 1) and copying stuff. Definitely it's not worth
introducing the common.util kind of approach for that single method, buut we
can later decide on common.utils and maybe a lot more common things. Or maybe
we decide not to use it at all (because yes - it introduces quite some hassle)
--
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]