MCPcopy Create free account
hub / github.com/MAC-VO/MAC-VO / IgnoreException

Function IgnoreException

Utility/Utils.py:147–159  ·  view source on GitHub ↗
(func: Callable[T_In, T_Out])

Source from the content-addressed store, hash-verified

145
146
147def IgnoreException(func: Callable[T_In, T_Out]) -> Callable[T_In, Optional[T_Out]]:
148 @wraps(func)
149 def wrapped(*args, **kwargs) -> Optional[T_Out]:
150 try:
151 result = func(*args, **kwargs)
152 except KeyboardInterrupt as e:
153 raise e from None
154 except Exception as e:
155 Logger.show_exception()
156 Logger.write("warn", f"Failed to execute function {func.__name__} due to exception:\n{e}")
157 result = None
158 return result
159 return wrapped
160
161def tensor_safe_asdict(obj):
162 if is_dataclass(obj):

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected