exception.py 876 B

12345678910111213141516171819202122232425
  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)