|
55 | 55 | _FOLDER_ERRORS: ExceptionToHttpErrorMap = { |
56 | 56 | FolderAccessForbiddenError: HttpErrorInfo( |
57 | 57 | status.HTTP_403_FORBIDDEN, |
58 | | - user_message("Access to folder forbidden"), |
| 58 | + user_message("Access to this folder is forbidden.", _version=1), |
59 | 59 | ), |
60 | 60 | FolderNotFoundError: HttpErrorInfo( |
61 | 61 | status.HTTP_404_NOT_FOUND, |
62 | | - user_message("Folder not found: {reason}"), |
| 62 | + user_message("The requested folder could not be found: {reason}", _version=1), |
63 | 63 | ), |
64 | 64 | } |
65 | 65 |
|
66 | 66 |
|
67 | 67 | _NODE_ERRORS: ExceptionToHttpErrorMap = { |
68 | 68 | NodeNotFoundError: HttpErrorInfo( |
69 | 69 | status.HTTP_404_NOT_FOUND, |
70 | | - user_message("Node '{node_uuid}' not found in project '{project_uuid}'"), |
| 70 | + user_message( |
| 71 | + "Node '{node_uuid}' was not found in project '{project_uuid}'.", _version=1 |
| 72 | + ), |
71 | 73 | ), |
72 | 74 | ParentNodeNotFoundError: HttpErrorInfo( |
73 | 75 | status.HTTP_404_NOT_FOUND, |
74 | | - user_message("Parent node '{node_uuid}' not found"), |
| 76 | + user_message("Parent node '{node_uuid}' was not found.", _version=1), |
75 | 77 | ), |
76 | 78 | ProjectNodeRequiredInputsNotSetError: HttpErrorInfo( |
77 | 79 | status.HTTP_409_CONFLICT, |
78 | | - user_message("Project node is required but input is not set"), |
| 80 | + user_message( |
| 81 | + "Required input values for this project node have not been set.", _version=1 |
| 82 | + ), |
79 | 83 | ), |
80 | 84 | } |
81 | 85 |
|
82 | 86 |
|
83 | 87 | _PROJECT_ERRORS: ExceptionToHttpErrorMap = { |
84 | 88 | ProjectDeleteError: HttpErrorInfo( |
85 | 89 | status.HTTP_409_CONFLICT, |
86 | | - "Failed to complete deletion of '{project_uuid}': {reason}", |
| 90 | + user_message( |
| 91 | + "Unable to complete deletion of project '{project_uuid}': {reason}", |
| 92 | + _version=1, |
| 93 | + ), |
87 | 94 | ), |
88 | 95 | ProjectGroupNotFoundError: HttpErrorInfo( |
89 | 96 | status.HTTP_404_NOT_FOUND, |
90 | | - "Project group not found: {reason}", |
| 97 | + user_message( |
| 98 | + "The requested project group could not be found: {reason}", _version=1 |
| 99 | + ), |
91 | 100 | ), |
92 | 101 | ProjectInvalidRightsError: HttpErrorInfo( |
93 | 102 | status.HTTP_403_FORBIDDEN, |
94 | | - "Do not have sufficient access rights on project {project_uuid} for this action", |
| 103 | + user_message( |
| 104 | + "You do not have sufficient access rights to perform this action on project {project_uuid}.", |
| 105 | + _version=1, |
| 106 | + ), |
95 | 107 | ), |
96 | 108 | InsufficientRoleForProjectTemplateTypeUpdateError: HttpErrorInfo( |
97 | 109 | status.HTTP_403_FORBIDDEN, |
98 | | - "Do not have sufficient access rights on updating project template type", |
| 110 | + user_message( |
| 111 | + "You do not have sufficient permissions to update the project template type.", |
| 112 | + _version=1, |
| 113 | + ), |
99 | 114 | ), |
100 | 115 | ProjectInvalidUsageError: HttpErrorInfo( |
101 | 116 | status.HTTP_422_UNPROCESSABLE_ENTITY, |
102 | | - "Invalid usage for project", |
| 117 | + user_message("The project cannot be used in this way.", _version=1), |
103 | 118 | ), |
104 | 119 | ProjectNotFoundError: HttpErrorInfo( |
105 | 120 | status.HTTP_404_NOT_FOUND, |
106 | | - "Project {project_uuid} not found", |
| 121 | + user_message("Project {project_uuid} could not be found.", _version=1), |
107 | 122 | ), |
108 | 123 | ProjectOwnerNotFoundInTheProjectAccessRightsError: HttpErrorInfo( |
109 | 124 | status.HTTP_400_BAD_REQUEST, |
110 | | - "Project owner identifier was not found in the project's access-rights field", |
| 125 | + user_message( |
| 126 | + "The project owner could not be found in the project's access rights.", |
| 127 | + _version=1, |
| 128 | + ), |
111 | 129 | ), |
112 | 130 | ProjectTooManyProjectOpenedError: HttpErrorInfo( |
113 | 131 | status.HTTP_409_CONFLICT, |
114 | | - "You cannot open more than {max_num_projects} study/ies at once. Please close another study and retry.", |
| 132 | + user_message( |
| 133 | + "You cannot open more than {max_num_projects} project/s at once. Please close another study and retry.", |
| 134 | + _version=1, |
| 135 | + ), |
115 | 136 | ), |
116 | 137 | ProjectStartsTooManyDynamicNodesError: HttpErrorInfo( |
117 | 138 | status.HTTP_409_CONFLICT, |
118 | | - "The maximal amount of concurrently running dynamic services was reached. Please manually stop a service and retry.", |
| 139 | + user_message( |
| 140 | + "The maximum number of concurrently running dynamic services has been reached. Please manually stop a service and retry.", |
| 141 | + _version=1, |
| 142 | + ), |
119 | 143 | ), |
120 | 144 | ProjectWalletPendingTransactionError: HttpErrorInfo( |
121 | 145 | status.HTTP_409_CONFLICT, |
122 | | - "Project has currently pending transactions. It is forbidden to change wallet.", |
| 146 | + user_message( |
| 147 | + "This project has pending transactions. Changing the wallet is currently not allowed.", |
| 148 | + _version=1, |
| 149 | + ), |
123 | 150 | ), |
124 | 151 | ProjectInDebtCanNotChangeWalletError: HttpErrorInfo( |
125 | 152 | status.HTTP_402_PAYMENT_REQUIRED, |
126 | | - "Unable to change the credit account linked to the project. The project is embargoed because the last transaction of {debt_amount} resulted in the credit account going negative.", |
| 153 | + user_message( |
| 154 | + "Unable to change the credit account linked to the project. The project is embargoed because the last transaction of {debt_amount} resulted in the credit account going negative.", |
| 155 | + _version=1, |
| 156 | + ), |
127 | 157 | ), |
128 | 158 | ProjectInDebtCanNotOpenError: HttpErrorInfo( |
129 | 159 | status.HTTP_402_PAYMENT_REQUIRED, |
130 | | - "Unable to open the project. The project is embargoed because the last transaction of {debt_amount} resulted in the credit account going negative.", |
| 160 | + user_message( |
| 161 | + "Unable to open the project. The project is embargoed because the last transaction of {debt_amount} resulted in the credit account going negative.", |
| 162 | + _version=1, |
| 163 | + ), |
131 | 164 | ), |
132 | 165 | WrongTagIdsInQueryError: HttpErrorInfo( |
133 | 166 | status.HTTP_400_BAD_REQUEST, |
134 | | - "Wrong tag IDs in query", |
| 167 | + user_message("Invalid tag IDs were provided in the request.", _version=1), |
135 | 168 | ), |
136 | 169 | ProjectTypeAndTemplateIncompatibilityError: HttpErrorInfo( |
137 | 170 | status.HTTP_400_BAD_REQUEST, |
138 | | - "Wrong project type and template type combination: {reason}", |
| 171 | + user_message( |
| 172 | + "The project type and template type combination is not valid: {reason}", |
| 173 | + _version=1, |
| 174 | + ), |
139 | 175 | ), |
140 | 176 | } |
141 | 177 |
|
142 | 178 |
|
143 | 179 | _WORKSPACE_ERRORS: ExceptionToHttpErrorMap = { |
144 | 180 | WorkspaceAccessForbiddenError: HttpErrorInfo( |
145 | 181 | status.HTTP_403_FORBIDDEN, |
146 | | - "Access to workspace forbidden: {reason}", |
| 182 | + user_message("Access to this workspace is forbidden: {reason}", _version=1), |
147 | 183 | ), |
148 | 184 | WorkspaceNotFoundError: HttpErrorInfo( |
149 | 185 | status.HTTP_404_NOT_FOUND, |
150 | | - "Workspace not found: {reason}", |
| 186 | + user_message( |
| 187 | + "The requested workspace could not be found: {reason}", _version=1 |
| 188 | + ), |
151 | 189 | ), |
152 | 190 | } |
153 | 191 |
|
154 | 192 |
|
155 | 193 | _WALLET_ERRORS: ExceptionToHttpErrorMap = { |
156 | 194 | UserDefaultWalletNotFoundError: HttpErrorInfo( |
157 | 195 | status.HTTP_404_NOT_FOUND, |
158 | | - "Wallet not found: {reason}", |
| 196 | + user_message("The requested wallet could not be found: {reason}", _version=1), |
159 | 197 | ), |
160 | 198 | WalletAccessForbiddenError: HttpErrorInfo( |
161 | 199 | status.HTTP_403_FORBIDDEN, |
162 | | - "Payment required, but the user lacks access to the project's linked wallet: Wallet access forbidden. {reason}", |
| 200 | + user_message( |
| 201 | + "Payment is required, but you do not have access to the project's linked wallet: {reason}", |
| 202 | + _version=1, |
| 203 | + ), |
163 | 204 | ), |
164 | 205 | WalletNotEnoughCreditsError: HttpErrorInfo( |
165 | 206 | status.HTTP_402_PAYMENT_REQUIRED, |
166 | | - "Wallet does not have enough credits. {reason}", |
| 207 | + user_message( |
| 208 | + "The wallet does not have enough credits to complete this operation: {reason}", |
| 209 | + _version=1, |
| 210 | + ), |
167 | 211 | ), |
168 | 212 | } |
169 | 213 |
|
170 | 214 |
|
171 | 215 | _PRICING_ERRORS: ExceptionToHttpErrorMap = { |
172 | 216 | DefaultPricingPlanNotFoundError: HttpErrorInfo( |
173 | 217 | status.HTTP_404_NOT_FOUND, |
174 | | - "Default pricing plan not found", |
| 218 | + user_message("The default pricing plan could not be found.", _version=1), |
175 | 219 | ), |
176 | 220 | DefaultPricingUnitNotFoundError: HttpErrorInfo( |
177 | 221 | status.HTTP_404_NOT_FOUND, |
178 | | - "Default pricing unit not found", |
| 222 | + user_message("The default pricing unit could not be found.", _version=1), |
179 | 223 | ), |
180 | 224 | } |
181 | 225 |
|
182 | 226 |
|
183 | 227 | _CONVERSATION_ERRORS: ExceptionToHttpErrorMap = { |
184 | 228 | ConversationErrorNotFoundError: HttpErrorInfo( |
185 | 229 | status.HTTP_404_NOT_FOUND, |
186 | | - "Conversation not found", |
| 230 | + user_message("The requested conversation could not be found.", _version=1), |
187 | 231 | ), |
188 | 232 | ConversationMessageErrorNotFoundError: HttpErrorInfo( |
189 | 233 | status.HTTP_404_NOT_FOUND, |
190 | | - "Conversation message not found", |
| 234 | + user_message( |
| 235 | + "The requested conversation message could not be found.", _version=1 |
| 236 | + ), |
191 | 237 | ), |
192 | 238 | } |
193 | 239 |
|
194 | 240 |
|
195 | 241 | _OTHER_ERRORS: ExceptionToHttpErrorMap = { |
196 | 242 | CatalogNotAvailableError: HttpErrorInfo( |
197 | 243 | status.HTTP_503_SERVICE_UNAVAILABLE, |
198 | | - "This service is currently not available", |
| 244 | + user_message("The catalog service is currently unavailable.", _version=1), |
199 | 245 | ), |
200 | 246 | ClustersKeeperNotAvailableError: HttpErrorInfo( |
201 | 247 | status.HTTP_503_SERVICE_UNAVAILABLE, |
202 | | - "Clusters-keeper service is not available", |
| 248 | + user_message( |
| 249 | + "The clusters-keeper service is currently unavailable.", _version=1 |
| 250 | + ), |
203 | 251 | ), |
204 | 252 | CatalogForbiddenError: HttpErrorInfo( |
205 | 253 | status.HTTP_403_FORBIDDEN, |
206 | | - "Catalog forbidden: Insufficient access rights for {name}", |
| 254 | + user_message( |
| 255 | + "Access denied: You do not have sufficient permissions for {name}.", |
| 256 | + _version=1, |
| 257 | + ), |
207 | 258 | ), |
208 | 259 | CatalogItemNotFoundError: HttpErrorInfo( |
209 | | - status.HTTP_404_NOT_FOUND, "{name} was not found" |
| 260 | + status.HTTP_404_NOT_FOUND, |
| 261 | + user_message("The requested item '{name}' was not found.", _version=1), |
210 | 262 | ), |
211 | 263 | } |
212 | 264 |
|
|
0 commit comments