Return the writeConcernError or None.
(result: Mapping[str, Any])
| 301 | |
| 302 | |
| 303 | def _get_wce_doc(result: Mapping[str, Any]) -> Optional[Mapping[str, Any]]: |
| 304 | """Return the writeConcernError or None.""" |
| 305 | wce = result.get("writeConcernError") |
| 306 | if wce: |
| 307 | # The server reports errorLabels at the top level but it's more |
| 308 | # convenient to attach it to the writeConcernError doc itself. |
| 309 | error_labels = result.get("errorLabels") |
| 310 | if error_labels: |
| 311 | # Copy to avoid changing the original document. |
| 312 | wce = wce.copy() |
| 313 | wce["errorLabels"] = error_labels |
| 314 | return wce |
| 315 | |
| 316 | |
| 317 | def _check_write_command_response(result: Mapping[str, Any]) -> None: |
no test coverage detected