errors.py 627 B

12345678910111213141516171819202122232425
  1. from libs.exception import BaseHTTPException
  2. class FileTooLargeError(BaseHTTPException):
  3. error_code = "file_too_large"
  4. description = "File size exceeded. {message}"
  5. code = 413
  6. class UnsupportedFileTypeError(BaseHTTPException):
  7. error_code = "unsupported_file_type"
  8. description = "File type not allowed."
  9. code = 415
  10. class TooManyFilesError(BaseHTTPException):
  11. error_code = "too_many_files"
  12. description = "Only one file is allowed."
  13. code = 400
  14. class NoFileUploadedError(BaseHTTPException):
  15. error_code = "no_file_uploaded"
  16. description = "Please upload your file."
  17. code = 400