##// END OF EJS Templates
chore: disabled audit functionality for now
chore: disabled audit functionality for now

File last commit:

r5522:33fc2e7c default
r5543:0d8cb28d default
Show More
exceptions.py
214 lines | 4.9 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
feat(artifacts): new artifact storage engines allowing an s3 based uploads
r5516 class AttachedArtifactsError(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, )
feat(vcs clients filtering): added changes related to vcs client filtering needed for EE. Fixes: RCCE-41
r5522 class ClientNotSupportedError(HTTPRequirementError):
title = explanation = 'Client Not Supported'
reason = None
project: added all source files and assets
r1 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
fix(user-models): added extra protection against model username changes that would create duplicates
r5352 class DuplicateUpdateUserError(Exception):
pass
project: added all source files and assets
r1 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)