Raised when encryption or decryption fails. This error always wraps another exception which can be retrieved via the :attr:`cause` property. .. versionadded:: 3.9
| 386 | |
| 387 | |
| 388 | class EncryptionError(PyMongoError): |
| 389 | """Raised when encryption or decryption fails. |
| 390 | |
| 391 | This error always wraps another exception which can be retrieved via the |
| 392 | :attr:`cause` property. |
| 393 | |
| 394 | .. versionadded:: 3.9 |
| 395 | """ |
| 396 | |
| 397 | def __init__(self, cause: Exception) -> None: |
| 398 | super().__init__(str(cause)) |
| 399 | self.__cause = cause |
| 400 | |
| 401 | @property |
| 402 | def cause(self) -> Exception: |
| 403 | """The exception that caused this encryption or decryption error.""" |
| 404 | return self.__cause |
| 405 | |
| 406 | @property |
| 407 | def timeout(self) -> bool: |
| 408 | if isinstance(self.__cause, PyMongoError): |
| 409 | return self.__cause.timeout |
| 410 | return False |
| 411 | |
| 412 | |
| 413 | class EncryptedCollectionError(EncryptionError): |
no outgoing calls