exceptions: skip extracting exception by deprecated .message attribute

This commit is contained in:
RhodeCode Admin 2023-07-26 10:17:55 +02:00
parent 6ad53fbb40
commit 257c91a1ad
3 changed files with 3 additions and 3 deletions

View file

@ -137,7 +137,7 @@ def exception_view(exc, request):
rpc_id = getattr(request, 'rpc_id', None)
if isinstance(exc, JSONRPCError):
fault_message = safe_str(exc.message)
fault_message = safe_str(exc)
log.debug('json-rpc error rpc_id:%s "%s"', rpc_id, fault_message)
elif isinstance(exc, JSONRPCValidationError):
colander_exc = exc.colander_exception

View file

@ -272,7 +272,7 @@ def cleanup_sessions(request, apiuser, older_then=Optional(60)):
older_than_seconds=older_than_seconds)
return {'sessions_removed': cleaned, 'backend': backend}
except user_sessions.CleanupCommand as msg:
return {'cleanup_command': msg.message, 'backend': backend}
return {'cleanup_command': str(msg), 'backend': backend}
except Exception as e:
log.exception('Failed session cleanup')
raise JSONRPCError(

View file

@ -83,7 +83,7 @@ class AdminSessionSettingsView(BaseAppView):
older_than_seconds=older_than_seconds)
h.flash(_('Cleaned up old sessions'), category='success')
except user_sessions.CleanupCommand as msg:
h.flash(msg.message, category='warning')
h.flash(str(msg), category='warning')
except Exception as e:
log.exception('Failed session cleanup')
h.flash(_('Failed to cleanup up old sessions'), category='error')