exception.py 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  1. class validator_exception(Exception):
  2. def __init__(self, name: str) -> None:
  3. super().__init__("Invalid property names: " + name + ".")
  4. class exists_exception(Exception):
  5. def __init__(self, name: str) -> None:
  6. super().__init__("Item with this " + name + " already in database.")
  7. class bad_request_exception(Exception):
  8. def __init__(self, content: str) -> None:
  9. super().__init__("Bad request: " + content + ".")
  10. class not_found_exception(Exception):
  11. def __init__(self) -> None:
  12. super().__init__("Not found required target.")
  13. class not_ready_exception(Exception):
  14. def __init__(self, target: any) -> None:
  15. dump = str(target)
  16. what = str(type(target))
  17. info = "Can not work, because " + what + " is not raeady.\n"
  18. info = info + "Dump:\n" + what + "\n\n"
  19. super().__init__(info)
  20. class in_collection_exception(Exception):
  21. pass
  22. class config_exception(Exception):
  23. pass
  24. class access_denied_exception(Exception):
  25. def __init__(self) -> None:
  26. super().__init__("Being logged in is required to access this.")
  27. class image_exception(Exception):
  28. def __init__(self) -> None:
  29. super().__init__("This is not property image file.")
  30. class directory_image_exception(Exception):
  31. pass
  32. class autoadder_exception(Exception):
  33. pass
  34. class image_save_exception(Exception):
  35. def __init__(self, before: Exception) -> None:
  36. super().__init__("Can not save image: " + str(before))
  37. class incomplete_request_exception(Exception):
  38. def __init__(self, name: str) -> None:
  39. content = "Request is not complete. This endpoint require "
  40. content = content + "\"" + name + "\"."
  41. super().__init__(content)
  42. class reservation_exception(Exception):
  43. pass
  44. class reservation_loader_exception(Exception):
  45. pass
  46. class database_exception(Exception):
  47. def __init__(self) -> None:
  48. super().__init__("Database can not commit changes.")
  49. class incorrect_target_exception(Exception):
  50. pass