Show More
The requested changes are too big and content was truncated. Show full diff
@@ -1,159 +1,171 b'' | |||||
1 | # -*- coding: utf-8 -*- |
|
1 | # -*- coding: utf-8 -*- | |
2 |
|
2 | |||
3 | # Copyright (C) 2010-2019 RhodeCode GmbH |
|
3 | # Copyright (C) 2010-2019 RhodeCode GmbH | |
4 | # |
|
4 | # | |
5 | # This program is free software: you can redistribute it and/or modify |
|
5 | # This program is free software: you can redistribute it and/or modify | |
6 | # it under the terms of the GNU Affero General Public License, version 3 |
|
6 | # it under the terms of the GNU Affero General Public License, version 3 | |
7 | # (only), as published by the Free Software Foundation. |
|
7 | # (only), as published by the Free Software Foundation. | |
8 | # |
|
8 | # | |
9 | # This program is distributed in the hope that it will be useful, |
|
9 | # This program is distributed in the hope that it will be useful, | |
10 | # but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
10 | # but WITHOUT ANY WARRANTY; without even the implied warranty of | |
11 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
11 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
12 | # GNU General Public License for more details. |
|
12 | # GNU General Public License for more details. | |
13 | # |
|
13 | # | |
14 | # You should have received a copy of the GNU Affero General Public License |
|
14 | # You should have received a copy of the GNU Affero General Public License | |
15 | # along with this program. If not, see <http://www.gnu.org/licenses/>. |
|
15 | # along with this program. If not, see <http://www.gnu.org/licenses/>. | |
16 | # |
|
16 | # | |
17 | # This program is dual-licensed. If you wish to learn more about the |
|
17 | # This program is dual-licensed. If you wish to learn more about the | |
18 | # RhodeCode Enterprise Edition, including its added features, Support services, |
|
18 | # RhodeCode Enterprise Edition, including its added features, Support services, | |
19 | # and proprietary license terms, please see https://rhodecode.com/licenses/ |
|
19 | # and proprietary license terms, please see https://rhodecode.com/licenses/ | |
20 |
|
20 | |||
21 | """ |
|
21 | """ | |
22 | Set of custom exceptions used in RhodeCode |
|
22 | Set of custom exceptions used in RhodeCode | |
23 | """ |
|
23 | """ | |
24 |
|
24 | |||
25 | from webob.exc import HTTPClientError |
|
25 | from webob.exc import HTTPClientError | |
26 | from pyramid.httpexceptions import HTTPBadGateway |
|
26 | from pyramid.httpexceptions import HTTPBadGateway | |
27 |
|
27 | |||
28 |
|
28 | |||
29 | class LdapUsernameError(Exception): |
|
29 | class LdapUsernameError(Exception): | |
30 | pass |
|
30 | pass | |
31 |
|
31 | |||
32 |
|
32 | |||
33 | class LdapPasswordError(Exception): |
|
33 | class LdapPasswordError(Exception): | |
34 | pass |
|
34 | pass | |
35 |
|
35 | |||
36 |
|
36 | |||
37 | class LdapConnectionError(Exception): |
|
37 | class LdapConnectionError(Exception): | |
38 | pass |
|
38 | pass | |
39 |
|
39 | |||
40 |
|
40 | |||
41 | class LdapImportError(Exception): |
|
41 | class LdapImportError(Exception): | |
42 | pass |
|
42 | pass | |
43 |
|
43 | |||
44 |
|
44 | |||
45 | class DefaultUserException(Exception): |
|
45 | class DefaultUserException(Exception): | |
46 | pass |
|
46 | pass | |
47 |
|
47 | |||
48 |
|
48 | |||
49 | class UserOwnsReposException(Exception): |
|
49 | class UserOwnsReposException(Exception): | |
50 | pass |
|
50 | pass | |
51 |
|
51 | |||
52 |
|
52 | |||
53 | class UserOwnsRepoGroupsException(Exception): |
|
53 | class UserOwnsRepoGroupsException(Exception): | |
54 | pass |
|
54 | pass | |
55 |
|
55 | |||
56 |
|
56 | |||
57 | class UserOwnsUserGroupsException(Exception): |
|
57 | class UserOwnsUserGroupsException(Exception): | |
58 | pass |
|
58 | pass | |
59 |
|
59 | |||
60 |
|
60 | |||
61 | class UserGroupAssignedException(Exception): |
|
61 | class UserGroupAssignedException(Exception): | |
62 | pass |
|
62 | pass | |
63 |
|
63 | |||
64 |
|
64 | |||
65 | class StatusChangeOnClosedPullRequestError(Exception): |
|
65 | class StatusChangeOnClosedPullRequestError(Exception): | |
66 | pass |
|
66 | pass | |
67 |
|
67 | |||
68 |
|
68 | |||
69 | class AttachedForksError(Exception): |
|
69 | class AttachedForksError(Exception): | |
70 | pass |
|
70 | pass | |
71 |
|
71 | |||
72 |
|
72 | |||
73 | class AttachedPullRequestsError(Exception): |
|
73 | class AttachedPullRequestsError(Exception): | |
74 | pass |
|
74 | pass | |
75 |
|
75 | |||
76 |
|
76 | |||
77 | class RepoGroupAssignmentError(Exception): |
|
77 | class RepoGroupAssignmentError(Exception): | |
78 | pass |
|
78 | pass | |
79 |
|
79 | |||
80 |
|
80 | |||
81 | class NonRelativePathError(Exception): |
|
81 | class NonRelativePathError(Exception): | |
82 | pass |
|
82 | pass | |
83 |
|
83 | |||
84 |
|
84 | |||
85 | class HTTPRequirementError(HTTPClientError): |
|
85 | class HTTPRequirementError(HTTPClientError): | |
86 | title = explanation = 'Repository Requirement Missing' |
|
86 | title = explanation = 'Repository Requirement Missing' | |
87 | reason = None |
|
87 | reason = None | |
88 |
|
88 | |||
89 | def __init__(self, message, *args, **kwargs): |
|
89 | def __init__(self, message, *args, **kwargs): | |
90 | self.title = self.explanation = message |
|
90 | self.title = self.explanation = message | |
91 | super(HTTPRequirementError, self).__init__(*args, **kwargs) |
|
91 | super(HTTPRequirementError, self).__init__(*args, **kwargs) | |
92 | self.args = (message, ) |
|
92 | self.args = (message, ) | |
93 |
|
93 | |||
94 |
|
94 | |||
95 | class HTTPLockedRC(HTTPClientError): |
|
95 | class HTTPLockedRC(HTTPClientError): | |
96 | """ |
|
96 | """ | |
97 | Special Exception For locked Repos in RhodeCode, the return code can |
|
97 | Special Exception For locked Repos in RhodeCode, the return code can | |
98 | be overwritten by _code keyword argument passed into constructors |
|
98 | be overwritten by _code keyword argument passed into constructors | |
99 | """ |
|
99 | """ | |
100 | code = 423 |
|
100 | code = 423 | |
101 | title = explanation = 'Repository Locked' |
|
101 | title = explanation = 'Repository Locked' | |
102 | reason = None |
|
102 | reason = None | |
103 |
|
103 | |||
104 | def __init__(self, message, *args, **kwargs): |
|
104 | def __init__(self, message, *args, **kwargs): | |
105 | from rhodecode import CONFIG |
|
105 | from rhodecode import CONFIG | |
106 | from rhodecode.lib.utils2 import safe_int |
|
106 | from rhodecode.lib.utils2 import safe_int | |
107 | _code = CONFIG.get('lock_ret_code') |
|
107 | _code = CONFIG.get('lock_ret_code') | |
108 | self.code = safe_int(_code, self.code) |
|
108 | self.code = safe_int(_code, self.code) | |
109 | self.title = self.explanation = message |
|
109 | self.title = self.explanation = message | |
110 | super(HTTPLockedRC, self).__init__(*args, **kwargs) |
|
110 | super(HTTPLockedRC, self).__init__(*args, **kwargs) | |
111 | self.args = (message, ) |
|
111 | self.args = (message, ) | |
112 |
|
112 | |||
113 |
|
113 | |||
114 | class HTTPBranchProtected(HTTPClientError): |
|
114 | class HTTPBranchProtected(HTTPClientError): | |
115 | """ |
|
115 | """ | |
116 | Special Exception For Indicating that branch is protected in RhodeCode, the |
|
116 | Special Exception For Indicating that branch is protected in RhodeCode, the | |
117 | return code can be overwritten by _code keyword argument passed into constructors |
|
117 | return code can be overwritten by _code keyword argument passed into constructors | |
118 | """ |
|
118 | """ | |
119 | code = 403 |
|
119 | code = 403 | |
120 | title = explanation = 'Branch Protected' |
|
120 | title = explanation = 'Branch Protected' | |
121 | reason = None |
|
121 | reason = None | |
122 |
|
122 | |||
123 | def __init__(self, message, *args, **kwargs): |
|
123 | def __init__(self, message, *args, **kwargs): | |
124 | self.title = self.explanation = message |
|
124 | self.title = self.explanation = message | |
125 | super(HTTPBranchProtected, self).__init__(*args, **kwargs) |
|
125 | super(HTTPBranchProtected, self).__init__(*args, **kwargs) | |
126 | self.args = (message, ) |
|
126 | self.args = (message, ) | |
127 |
|
127 | |||
128 |
|
128 | |||
129 | class IMCCommitError(Exception): |
|
129 | class IMCCommitError(Exception): | |
130 | pass |
|
130 | pass | |
131 |
|
131 | |||
132 |
|
132 | |||
133 | class UserCreationError(Exception): |
|
133 | class UserCreationError(Exception): | |
134 | pass |
|
134 | pass | |
135 |
|
135 | |||
136 |
|
136 | |||
137 | class NotAllowedToCreateUserError(Exception): |
|
137 | class NotAllowedToCreateUserError(Exception): | |
138 | pass |
|
138 | pass | |
139 |
|
139 | |||
140 |
|
140 | |||
141 | class RepositoryCreationError(Exception): |
|
141 | class RepositoryCreationError(Exception): | |
142 | pass |
|
142 | pass | |
143 |
|
143 | |||
144 |
|
144 | |||
145 | class VCSServerUnavailable(HTTPBadGateway): |
|
145 | class VCSServerUnavailable(HTTPBadGateway): | |
146 | """ HTTP Exception class for VCS Server errors """ |
|
146 | """ HTTP Exception class for VCS Server errors """ | |
147 | code = 502 |
|
147 | code = 502 | |
148 | title = 'VCS Server Error' |
|
148 | title = 'VCS Server Error' | |
149 | causes = [ |
|
149 | causes = [ | |
150 | 'VCS Server is not running', |
|
150 | 'VCS Server is not running', | |
151 | 'Incorrect vcs.server=host:port', |
|
151 | 'Incorrect vcs.server=host:port', | |
152 | 'Incorrect vcs.server.protocol', |
|
152 | 'Incorrect vcs.server.protocol', | |
153 | ] |
|
153 | ] | |
154 |
|
154 | |||
155 | def __init__(self, message=''): |
|
155 | def __init__(self, message=''): | |
156 | self.explanation = 'Could not connect to VCS Server' |
|
156 | self.explanation = 'Could not connect to VCS Server' | |
157 | if message: |
|
157 | if message: | |
158 | self.explanation += ': ' + message |
|
158 | self.explanation += ': ' + message | |
159 | super(VCSServerUnavailable, self).__init__() |
|
159 | super(VCSServerUnavailable, self).__init__() | |
|
160 | ||||
|
161 | ||||
|
162 | class ArtifactMetadataDuplicate(ValueError): | |||
|
163 | ||||
|
164 | def __init__(self, *args, **kwargs): | |||
|
165 | self.err_section = kwargs.pop('err_section', None) | |||
|
166 | self.err_key = kwargs.pop('err_key', None) | |||
|
167 | super(ArtifactMetadataDuplicate, self).__init__(*args, **kwargs) | |||
|
168 | ||||
|
169 | ||||
|
170 | class ArtifactMetadataBadValueType(ValueError): | |||
|
171 | pass |
1 | NO CONTENT: modified file |
|
NO CONTENT: modified file | ||
The requested commit or file is too big and content was truncated. Show full diff |
General Comments 0
You need to be logged in to leave comments.
Login now