Module astrapy.exceptions.collection_exceptions
Classes
class CollectionDeleteManyException (partial_result: CollectionDeleteResult, cause: Exception)-
Expand source code
@dataclass class CollectionDeleteManyException(DataAPIException): """ An exception occurring during a delete_many (an operation that can span several requests). As such, besides information on the root-cause error, there may be a partial result about the part that succeeded. Attributes: partial_result: a CollectionDeleteResult object, just like the one that would be the return value of the operation, had it succeeded completely. cause: a root exception that happened during the delete_many, causing the method call to stop and raise this error. """ partial_result: CollectionDeleteResult cause: Exception def __str__(self) -> str: return f"{self.__class__.__name__}({self.cause.__str__()})"An exception occurring during a delete_many (an operation that can span several requests). As such, besides information on the root-cause error, there may be a partial result about the part that succeeded.
Attributes
partial_result- a CollectionDeleteResult object, just like the one that would be the return value of the operation, had it succeeded completely.
cause- a root exception that happened during the delete_many, causing the method call to stop and raise this error.
Ancestors
- DataAPIException
- builtins.Exception
- builtins.BaseException
Instance variables
var cause : Exception-
The type of the None singleton.
var partial_result : CollectionDeleteResult-
The type of the None singleton.
class CollectionInsertManyException (inserted_ids: list[Any], exceptions: Sequence[Exception])-
Expand source code
@dataclass class CollectionInsertManyException(DataAPIException): """ An exception occurring within an insert_many (an operation that can span several requests). As such, it represents both the root error(s) that happened and information on the portion of the documents that were successfully inserted. The behaviour of insert_many (concurrency and the `ordered` setting) make it possible that more than one "root errors" are collected. Attributes: inserted_ids: a list of the document IDs that have been successfully inserted. exceptions: a list of the root exceptions leading to this error. The list, under normal circumstances, is not empty. """ inserted_ids: list[Any] exceptions: Sequence[Exception] def __str__(self) -> str: num_ids = len(self.inserted_ids) if self.exceptions: exc_desc: str excs_strs = [exc.__str__() for exc in self.exceptions[:8]] if len(self.exceptions) > 8: exc_desc = ", ".join(excs_strs) + " ... (more exceptions)" else: exc_desc = ", ".join(excs_strs) return ( f"{self.__class__.__name__}({exc_desc} [with {num_ids} inserted ids])" ) else: return f"{self.__class__.__name__}()"An exception occurring within an insert_many (an operation that can span several requests). As such, it represents both the root error(s) that happened and information on the portion of the documents that were successfully inserted.
The behaviour of insert_many (concurrency and the
orderedsetting) make it possible that more than one "root errors" are collected.Attributes
inserted_ids- a list of the document IDs that have been successfully inserted.
exceptions- a list of the root exceptions leading to this error. The list, under normal circumstances, is not empty.
Ancestors
- DataAPIException
- builtins.Exception
- builtins.BaseException
Instance variables
var exceptions : Sequence[Exception]-
The type of the None singleton.
var inserted_ids : list[typing.Any]-
The type of the None singleton.
class CollectionUpdateManyException (partial_result: CollectionUpdateResult, cause: Exception)-
Expand source code
@dataclass class CollectionUpdateManyException(DataAPIException): """ An exception occurring during an update_many (an operation that can span several requests). As such, besides information on the root-cause error, there may be a partial result about the part that succeeded. Attributes: partial_result: a CollectionUpdateResult object, just like the one that would be the return value of the operation, had it succeeded completely. cause: a root exception that happened during the update_many, causing the method call to stop and raise this error. """ partial_result: CollectionUpdateResult cause: Exception def __str__(self) -> str: return f"{self.__class__.__name__}({self.cause.__str__()})"An exception occurring during an update_many (an operation that can span several requests). As such, besides information on the root-cause error, there may be a partial result about the part that succeeded.
Attributes
partial_result- a CollectionUpdateResult object, just like the one that would be the return value of the operation, had it succeeded completely.
cause- a root exception that happened during the update_many, causing the method call to stop and raise this error.
Ancestors
- DataAPIException
- builtins.Exception
- builtins.BaseException
Instance variables
var cause : Exception-
The type of the None singleton.
var partial_result : CollectionUpdateResult-
The type of the None singleton.
class TooManyDocumentsToCountException (text: str, *, server_max_count_exceeded: bool)-
Expand source code
@dataclass class TooManyDocumentsToCountException(DataAPIException): """ A `count_documents()` operation on a collection failed because the resulting number of documents exceeded either the upper bound set by the caller or the hard limit imposed by the Data API. Attributes: text: a text message about the exception. server_max_count_exceeded: True if the count limit imposed by the API is reached. In that case, increasing the upper bound in the method invocation is of no help. """ text: str server_max_count_exceeded: bool def __init__( self, text: str, *, server_max_count_exceeded: bool, ) -> None: super().__init__(text) self.text = text self.server_max_count_exceeded = server_max_count_exceededA
count_documents()operation on a collection failed because the resulting number of documents exceeded either the upper bound set by the caller or the hard limit imposed by the Data API.Attributes
text- a text message about the exception.
server_max_count_exceeded- True if the count limit imposed by the API is reached. In that case, increasing the upper bound in the method invocation is of no help.
Ancestors
- DataAPIException
- builtins.Exception
- builtins.BaseException
Instance variables
var server_max_count_exceeded : bool-
The type of the None singleton.
var text : str-
The type of the None singleton.