##// END OF EJS Templates
my-account: fixed pagination of unread messages
my-account: fixed pagination of unread messages

File last commit:

r5095:aa627a5f default
r5115:e7219b77 default
Show More
exceptions.py
201 lines | 4.7 KiB | text/x-python | PythonLexer
copyrights: updated for 2023
r5088 # Copyright (C) 2010-2023 RhodeCode GmbH
project: added all source files and assets
r1 #
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License, version 3
# (only), as published by the Free Software Foundation.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
# This program is dual-licensed. If you wish to learn more about the
# RhodeCode Enterprise Edition, including its added features, Support services,
# and proprietary license terms, please see https://rhodecode.com/licenses/
"""
Set of custom exceptions used in RhodeCode
"""
from webob.exc import HTTPClientError
dan
vcs-error: replace disable_vcs middleware with vcs and http exceptions...
r682 from pyramid.httpexceptions import HTTPBadGateway
project: added all source files and assets
r1
class LdapUsernameError(Exception):
pass
class LdapPasswordError(Exception):
pass
class LdapConnectionError(Exception):
pass
class LdapImportError(Exception):
pass
class DefaultUserException(Exception):
pass
class UserOwnsReposException(Exception):
pass
class UserOwnsRepoGroupsException(Exception):
pass
class UserOwnsUserGroupsException(Exception):
pass
dan
users: added option to detach pull requests for users which we delete....
r4351 class UserOwnsPullRequestsException(Exception):
pass
artifacts: handle detach/delete of artifacts for users who own them and are to be deleted....
r4011 class UserOwnsArtifactsException(Exception):
pass
project: added all source files and assets
r1 class UserGroupAssignedException(Exception):
pass
class StatusChangeOnClosedPullRequestError(Exception):
pass
class AttachedForksError(Exception):
pass
repository: add check preventing of removal of repo with attached pull requests....
r3089 class AttachedPullRequestsError(Exception):
pass
project: added all source files and assets
r1 class RepoGroupAssignmentError(Exception):
pass
class NonRelativePathError(Exception):
pass
class HTTPRequirementError(HTTPClientError):
title = explanation = 'Repository Requirement Missing'
reason = None
def __init__(self, message, *args, **kwargs):
self.title = self.explanation = message
modernize: updates for python3
r5095 super().__init__(*args, **kwargs)
project: added all source files and assets
r1 self.args = (message, )
class HTTPLockedRC(HTTPClientError):
"""
Special Exception For locked Repos in RhodeCode, the return code can
be overwritten by _code keyword argument passed into constructors
"""
code = 423
title = explanation = 'Repository Locked'
reason = None
def __init__(self, message, *args, **kwargs):
libs: major refactor for python3
r5085 import rhodecode
self.code = rhodecode.ConfigGet().get_int('lock_ret_code', missing=self.code)
project: added all source files and assets
r1 self.title = self.explanation = message
modernize: updates for python3
r5095 super().__init__(*args, **kwargs)
project: added all source files and assets
r1 self.args = (message, )
branch-permissions: handle vcs operations and branch permissions....
r2979 class HTTPBranchProtected(HTTPClientError):
"""
Special Exception For Indicating that branch is protected in RhodeCode, the
return code can be overwritten by _code keyword argument passed into constructors
"""
code = 403
title = explanation = 'Branch Protected'
reason = None
def __init__(self, message, *args, **kwargs):
self.title = self.explanation = message
modernize: updates for python3
r5095 super().__init__(*args, **kwargs)
branch-permissions: handle vcs operations and branch permissions....
r2979 self.args = (message, )
project: added all source files and assets
r1 class IMCCommitError(Exception):
pass
class UserCreationError(Exception):
pass
class NotAllowedToCreateUserError(Exception):
pass
class RepositoryCreationError(Exception):
pass
dan
vcs-error: replace disable_vcs middleware with vcs and http exceptions...
r682
class VCSServerUnavailable(HTTPBadGateway):
""" HTTP Exception class for VCS Server errors """
code = 502
title = 'VCS Server Error'
dan
ux: show list of causes for vcs unavailable error page
r683 causes = [
'VCS Server is not running',
'Incorrect vcs.server=host:port',
'Incorrect vcs.server.protocol',
]
core: properly report 502 errors for gevent and gunicorn....
r2554
dan
vcs-error: replace disable_vcs middleware with vcs and http exceptions...
r682 def __init__(self, message=''):
self.explanation = 'Could not connect to VCS Server'
if message:
self.explanation += ': ' + message
modernize: updates for python3
r5095 super().__init__()
artifacts: refactor metadata code...
r3997
class ArtifactMetadataDuplicate(ValueError):
def __init__(self, *args, **kwargs):
self.err_section = kwargs.pop('err_section', None)
self.err_key = kwargs.pop('err_key', None)
modernize: updates for python3
r5095 super().__init__(*args, **kwargs)
artifacts: refactor metadata code...
r3997
class ArtifactMetadataBadValueType(ValueError):
pass
comment-history: fixes/ui changes...
r4408
class CommentVersionMismatch(ValueError):
pass
libs: major refactor for python3
r5085
class SignatureVerificationError(ValueError):
pass
def signature_verification_error(msg):
details = """
Encryption signature verification failed.
Please check your value of secret key, and/or encrypted value stored.
Secret key stored inside .ini file:
`rhodecode.encrypted_values.secret` or defaults to
`beaker.session.secret`
Probably the stored values were encrypted using a different secret then currently set in .ini file
"""
final_msg = f'{msg}\n{details}'
return SignatureVerificationError(final_msg)