exceptions.py 834 B

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