Internal helper for raising DocumentTooLarge.
(operation: str, doc_size: int, max_size: int)
| 745 | |
| 746 | |
| 747 | def _raise_document_too_large(operation: str, doc_size: int, max_size: int) -> NoReturn: |
| 748 | """Internal helper for raising DocumentTooLarge.""" |
| 749 | if operation == "insert": |
| 750 | raise DocumentTooLarge( |
| 751 | "BSON document too large (%d bytes)" |
| 752 | " - the connected server supports" |
| 753 | " BSON document sizes up to %d" |
| 754 | " bytes." % (doc_size, max_size) |
| 755 | ) |
| 756 | else: |
| 757 | # There's nothing intelligent we can say |
| 758 | # about size for update and delete |
| 759 | raise DocumentTooLarge(f"{operation!r} command document too large") |
| 760 | |
| 761 | |
| 762 | # From the Client Side Encryption spec: |
no test coverage detected