mirror of
https://0xacab.org/johnxina/rat.git
synced 2024-12-23 13:09:08 +00:00
41 lines
1.3 KiB
Diff
41 lines
1.3 KiB
Diff
|
--- venv/lib/python3.11/site-packages/aiotieba/helper/utils.py
|
||
|
+++ venv/lib/python3.11/site-packages/aiotieba/helper/utils.py
|
||
|
@@ -141,35 +141,6 @@
|
||
|
|
||
|
def wrapper(func):
|
||
|
async def awrapper(*args, **kwargs):
|
||
|
- try:
|
||
|
- ret = await func(*args, **kwargs)
|
||
|
-
|
||
|
- except Exception as err:
|
||
|
- meth_name = func.__name__
|
||
|
- tb = err.__traceback__
|
||
|
- while tb := tb.tb_next:
|
||
|
- frame = tb.tb_frame
|
||
|
- if frame.f_code.co_name == meth_name:
|
||
|
- break
|
||
|
- frame = tb.tb_next.tb_frame
|
||
|
-
|
||
|
- log_str: str = frame.f_locals.get('__log__', '')
|
||
|
- if not no_format: # need format
|
||
|
- log_str = log_str.format(**frame.f_locals)
|
||
|
- log_str = f"{err}. {log_str}"
|
||
|
-
|
||
|
- logger = get_logger()
|
||
|
- if logger.isEnabledFor(log_level):
|
||
|
- record = logger.makeRecord(logger.name, log_level, None, 0, log_str, None, None, meth_name)
|
||
|
- logger.handle(record)
|
||
|
-
|
||
|
- exc_handlers._handle(meth_name, err)
|
||
|
-
|
||
|
- return null_ret_factory()
|
||
|
-
|
||
|
- else:
|
||
|
- return ret
|
||
|
-
|
||
|
+ return await func(*args, **kwargs)
|
||
|
return awrapper
|
||
|
-
|
||
|
return wrapper
|
||
|
|