exceptions.py 784 B

123456789101112131415161718192021222324252627282930313233343536373839
  1. class FileNotExisted(Exception):
  2. def __init__(self, path):
  3. self.path = path
  4. def __str__(self):
  5. return f'File {self.path} does not exist.'
  6. class InvalidConfig(Exception):
  7. def __init__(self, msg):
  8. self.msg = msg
  9. def __str__(self):
  10. return f'Invalid config: {self.msg}'
  11. class InvalidParams(Exception):
  12. def __init__(self, msg):
  13. self.msg = msg
  14. def __str__(self):
  15. return f'Invalid params: {self.msg}'
  16. class EmptyData(Exception):
  17. def __init__(self, msg):
  18. self.msg = msg
  19. def __str__(self):
  20. return f'Empty data: {self.msg}'
  21. class CUDA_NOT_AVAILABLE(Exception):
  22. def __init__(self, msg):
  23. self.msg = msg
  24. def __str__(self):
  25. return f'CUDA not available: {self.msg}'