mirror of
https://github.com/Chia-Network/chia-blockchain.git
synced 2024-11-09 17:36:14 +03:00
16 lines
364 B
Python
16 lines
364 B
Python
from __future__ import annotations
|
|
|
|
import logging
|
|
import traceback
|
|
from contextlib import contextmanager
|
|
|
|
|
|
@contextmanager
|
|
def log_exceptions(log: logging.Logger, *, consume: bool = False):
|
|
try:
|
|
yield
|
|
except Exception as e:
|
|
log.error(f"Caught Exception: {e}. Traceback: {traceback.format_exc()}")
|
|
if not consume:
|
|
raise
|