diff --git a/src/BowongModalFunctions/utils/SentryUtils.py b/src/BowongModalFunctions/utils/SentryUtils.py index 159c37b..5e2703b 100644 --- a/src/BowongModalFunctions/utils/SentryUtils.py +++ b/src/BowongModalFunctions/utils/SentryUtils.py @@ -84,6 +84,7 @@ class SentryUtils: @functools.wraps(func) async def async_wrapper(*args, **kwargs): + excep = None try: result = await func(*args, **kwargs) status = TaskStatus.success @@ -95,6 +96,7 @@ class SentryUtils: code = ErrorCode.BUSINESS_ERROR.value except Exception as e: logger.exception(e) + excep = e result = None status = TaskStatus.failed error = e.message if hasattr(e, 'message') else str(e) @@ -116,6 +118,8 @@ class SentryUtils: error=error, code=code, results=results, )) + if excep: + raise Exception(excep) return result return async_wrapper