Source code for neosqlite.gridfs.errors
[docs]
class NeoSQLiteError(Exception):
"""Base class for all NeoSQLite exceptions."""
[docs]
def __init__(self, message: str = "", error_labels=None):
super().__init__(message)
self._message = message
self._error_labels = set(error_labels or [])
[docs]
def has_error_label(self, label: str) -> bool:
return label in self._error_labels
[docs]
def _add_error_label(self, label: str) -> None:
self._error_labels.add(label)
[docs]
def _remove_error_label(self, label: str) -> None:
self._error_labels.discard(label)
@property
def timeout(self) -> bool:
return False
[docs]
class GridFSError(NeoSQLiteError):
"""Base class for all GridFS exceptions."""
[docs]
class NoFile(GridFSError):
"""Raised when trying to access a non-existent file in GridFS."""
[docs]
class FileExists(GridFSError):
"""Raised when trying to create a file that already exists in GridFS."""
[docs]
class CorruptGridFile(GridFSError):
"""Raised when a file in GridFS is corrupt or incomplete."""
# PyMongo compatibility aliases
PyMongoError = NeoSQLiteError