gopidesupavan commented on PR #53434:
URL: https://github.com/apache/airflow/pull/53434#issuecomment-3081092174
an example it simulates that behaviours
```
import traceback
import warnings
from contextlib import contextmanager
@contextmanager
def suppress_and_warn(*exceptions: type[BaseException]):
try:
yield
except exceptions as e:
warnings.warn(
f"Exception suppressed: {e}\n{traceback.format_exc()}",
category=UserWarning,
stacklevel=3,
)
def get_automcommit():
raise Exception("get_automcommit is not implemented")
def check():
with suppress_and_warn(Exception):
return get_automcommit()
return False
result = check()
if not result:
print("Returned .", result)
```
--
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]