提交一下,准备更换总线通信架构
This commit is contained in:
		
							
								
								
									
										15
									
								
								toolbox/codes/common/exception_handler.py
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										15
									
								
								toolbox/codes/common/exception_handler.py
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,15 @@
 | 
			
		||||
from functools import wraps
 | 
			
		||||
from codes.common import db_operation
 | 
			
		||||
 | 
			
		||||
def handle_exception(module, stop: bool = False):
 | 
			
		||||
    def exceptions(func):
 | 
			
		||||
        @wraps(func)
 | 
			
		||||
        def wrapper(*args, **kwargs):
 | 
			
		||||
            try:
 | 
			
		||||
                return func(*args, **kwargs)
 | 
			
		||||
            except Exception as e:
 | 
			
		||||
                db_operation.db_write_logs(e, module, "exception")
 | 
			
		||||
                if stop:
 | 
			
		||||
                    raise e
 | 
			
		||||
        return wrapper
 | 
			
		||||
    return exceptions
 | 
			
		||||
		Reference in New Issue
	
	Block a user