MCPcopy Index your code
hub / github.com/mongodb/mongo-python-driver / _raise_last_write_error

Function _raise_last_write_error

pymongo/helpers_shared.py:287–293  ·  view source on GitHub ↗
(write_errors: list[Any])

Source from the content-addressed store, hash-verified

285
286
287def _raise_last_write_error(write_errors: list[Any]) -> NoReturn:
288 # If the last batch had multiple errors only report
289 # the last error to emulate continue_on_error.
290 error = write_errors[-1]
291 if error.get("code") == 11000:
292 raise DuplicateKeyError(error.get("errmsg"), 11000, error)
293 raise WriteError(error.get("errmsg"), error.get("code"), error)
294
295
296def _raise_write_concern_error(error: Any) -> NoReturn:

Callers 1

Calls 3

DuplicateKeyErrorClass · 0.90
WriteErrorClass · 0.90
getMethod · 0.45

Tested by

no test coverage detected