| 
									
										
										
										
											2023-05-15 08:51:32 +08:00
										 |  |  | from libs.exception import BaseHTTPException | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | class NoFileUploadedError(BaseHTTPException): | 
					
						
							|  |  |  |     error_code = 'no_file_uploaded' | 
					
						
							| 
									
										
										
										
											2023-05-22 17:39:28 +08:00
										 |  |  |     description = "Please upload your file." | 
					
						
							| 
									
										
										
										
											2023-05-15 08:51:32 +08:00
										 |  |  |     code = 400 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | class TooManyFilesError(BaseHTTPException): | 
					
						
							|  |  |  |     error_code = 'too_many_files' | 
					
						
							|  |  |  |     description = "Only one file is allowed." | 
					
						
							|  |  |  |     code = 400 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | class FileTooLargeError(BaseHTTPException): | 
					
						
							|  |  |  |     error_code = 'file_too_large' | 
					
						
							|  |  |  |     description = "File size exceeded. {message}" | 
					
						
							|  |  |  |     code = 413 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | class UnsupportedFileTypeError(BaseHTTPException): | 
					
						
							|  |  |  |     error_code = 'unsupported_file_type' | 
					
						
							|  |  |  |     description = "File type not allowed." | 
					
						
							|  |  |  |     code = 415 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | class HighQualityDatasetOnlyError(BaseHTTPException): | 
					
						
							|  |  |  |     error_code = 'high_quality_dataset_only' | 
					
						
							| 
									
										
										
										
											2023-05-22 17:39:28 +08:00
										 |  |  |     description = "Current operation only supports 'high-quality' datasets." | 
					
						
							| 
									
										
										
										
											2023-05-15 08:51:32 +08:00
										 |  |  |     code = 400 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | class DatasetNotInitializedError(BaseHTTPException): | 
					
						
							|  |  |  |     error_code = 'dataset_not_initialized' | 
					
						
							| 
									
										
										
										
											2023-05-22 17:39:28 +08:00
										 |  |  |     description = "The dataset is still being initialized or indexing. Please wait a moment." | 
					
						
							| 
									
										
										
										
											2023-05-15 08:51:32 +08:00
										 |  |  |     code = 400 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | class ArchivedDocumentImmutableError(BaseHTTPException): | 
					
						
							|  |  |  |     error_code = 'archived_document_immutable' | 
					
						
							| 
									
										
										
										
											2023-05-22 17:39:28 +08:00
										 |  |  |     description = "The archived document is not editable." | 
					
						
							| 
									
										
										
										
											2023-05-15 08:51:32 +08:00
										 |  |  |     code = 403 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | class DatasetNameDuplicateError(BaseHTTPException): | 
					
						
							|  |  |  |     error_code = 'dataset_name_duplicate' | 
					
						
							| 
									
										
										
										
											2023-05-22 17:39:28 +08:00
										 |  |  |     description = "The dataset name already exists. Please modify your dataset name." | 
					
						
							| 
									
										
										
										
											2023-05-15 08:51:32 +08:00
										 |  |  |     code = 409 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | class InvalidActionError(BaseHTTPException): | 
					
						
							|  |  |  |     error_code = 'invalid_action' | 
					
						
							|  |  |  |     description = "Invalid action." | 
					
						
							|  |  |  |     code = 400 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | class DocumentAlreadyFinishedError(BaseHTTPException): | 
					
						
							|  |  |  |     error_code = 'document_already_finished' | 
					
						
							| 
									
										
										
										
											2023-05-22 17:39:28 +08:00
										 |  |  |     description = "The document has been processed. Please refresh the page or go to the document details." | 
					
						
							| 
									
										
										
										
											2023-05-15 08:51:32 +08:00
										 |  |  |     code = 400 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | class DocumentIndexingError(BaseHTTPException): | 
					
						
							|  |  |  |     error_code = 'document_indexing' | 
					
						
							| 
									
										
										
										
											2023-05-22 17:39:28 +08:00
										 |  |  |     description = "The document is being processed and cannot be edited." | 
					
						
							| 
									
										
										
										
											2023-05-15 08:51:32 +08:00
										 |  |  |     code = 400 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | class InvalidMetadataError(BaseHTTPException): | 
					
						
							|  |  |  |     error_code = 'invalid_metadata' | 
					
						
							| 
									
										
										
										
											2023-05-22 17:39:28 +08:00
										 |  |  |     description = "The metadata content is incorrect. Please check and verify." | 
					
						
							| 
									
										
										
										
											2023-05-15 08:51:32 +08:00
										 |  |  |     code = 400 |