exc.py 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283
  1. __all__ = [
  2. "VecsException",
  3. "CollectionAlreadyExists",
  4. "CollectionNotFound",
  5. "ArgError",
  6. "FilterError",
  7. "IndexNotFound",
  8. "Unreachable",
  9. ]
  10. class VecsException(Exception):
  11. """
  12. Base exception class for the 'vecs' package.
  13. All custom exceptions in the 'vecs' package should derive from this class.
  14. """
  15. ...
  16. class CollectionAlreadyExists(VecsException):
  17. """
  18. Exception raised when attempting to create a collection that already exists.
  19. """
  20. ...
  21. class CollectionNotFound(VecsException):
  22. """
  23. Exception raised when attempting to access or manipulate a collection that does not exist.
  24. """
  25. ...
  26. class ArgError(VecsException):
  27. """
  28. Exception raised for invalid arguments when calling a method.
  29. """
  30. ...
  31. class MismatchedDimension(ArgError):
  32. """
  33. Exception raised when multiple sources of truth for a collection's embedding dimension do not match.
  34. """
  35. ...
  36. class FilterError(VecsException):
  37. """
  38. Exception raised when there's an error related to filter usage in a query.
  39. """
  40. ...
  41. class IndexNotFound(VecsException):
  42. """
  43. Exception raised when attempting to access an index that does not exist.
  44. """
  45. ...
  46. class Unreachable(VecsException):
  47. """
  48. Exception raised when an unreachable part of the code is executed.
  49. This is typically used for error handling in cases that should be logically impossible.
  50. """
  51. ...
  52. class MissingDependency(VecsException, ImportError):
  53. """
  54. Exception raised when attempting to access a feature that requires an optional dependency when the optional dependency is not present.
  55. """
  56. ...