INNER CODE UNIT · Python
catch_user_error
Marven11/EtherGhost · ether_ghost/main.py:152
def catch_user_error(fn):
@functools.wraps(fn)
async def _wraps(*args, **kwargs):
try:
return await fn(*args, **kwargs)
except core.SessionException as exc:
return {
"code": getattr(type(exc), "code", -500),
"msg": f"{type(exc).__doc__}: {str(exc)}",
}
return _wraps
async def list_sessions_readable():
result = session_manager.list_sessions_db_readable() + [
session_manager.session_to_readable(session)
for session in session_connector.list_sessions()