Skip to content

Commit d60da9e

Browse files
committed
DOCSP-30350 code examples and additional getCategory information
1 parent 1d219ee commit d60da9e

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

source/crud/operation-error-handling.txt

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -79,15 +79,18 @@ error message:
7979
.. code-block:: none
8080
:copyable: false
8181

82-
WriteError{code=11000, message='E11000 duplicate key error
83-
collection: testDB.testCollection index: _id_ dup key: { _id: 1 }',
84-
details=Document{{}}}
82+
WriteError{code=11000, message='E11000 duplicate key error
83+
collection: testDB.testCollection index: _id_ dup key: { _id: 1 }',
84+
details=Document{{}}}
8585

8686
In the preceding error message, the ``message`` field describes the reason for
8787
the error, and the ``details`` field provides specific details about the failing
8888
operation. To address this error, you must revise the document to have a unique
8989
``ObjectId``.
9090

91+
If you run the ``getCategory`` method on this ``WriteError`` object, it would
92+
return an ``ErrorCategory`` of ``DUPLICATE_KEY``.
93+
9194
Bulk Write Error
9295
----------------
9396

0 commit comments

Comments
 (0)