Skip to content

Commit ff26b12

Browse files
authored
fix(NODE-3769): retryable writes are not compliant with specification (#3144)
1 parent 6f633d1 commit ff26b12

33 files changed

+922
-753
lines changed

.eslintrc.json

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,10 @@
6666
{
6767
"name": ".",
6868
"message": "Please import directly from the relevant file instead."
69+
},
70+
{
71+
"name": "..",
72+
"message": "Please import directly from the relevant file instead."
6973
}
7074
]
7175
}
@@ -158,7 +162,8 @@
158162
"parser": "@typescript-eslint/parser",
159163
"rules": {
160164
"no-console": "off",
161-
"no-restricted-syntax": "off"
165+
"no-restricted-syntax": "off",
166+
"typescript-eslint/ban-ts-comment": "off"
162167
}
163168
},
164169
{

etc/charts/README.md

Lines changed: 0 additions & 11 deletions
This file was deleted.

etc/charts/build_images.sh

Lines changed: 0 additions & 13 deletions
This file was deleted.

etc/charts/imgs/MongoError.svg

Lines changed: 0 additions & 1 deletion
This file was deleted.

etc/charts/mermaid/MongoError.mmd

Lines changed: 0 additions & 22 deletions
This file was deleted.

etc/notes/errors.md

Lines changed: 35 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
- [`MongoDriverError`](#MongoDriverError)
1515
- [`MongoAPIError`](#MongoAPIError)
1616
- [`MongoRuntimeError`](#MongoRuntimeError)
17+
- [`MongoUnexpectedServerResponseError`](#MongoUnexpectedServerResponseError)
1718
- [`MongoNetworkError`](#MongoNetworkError)
1819
- [`MongoServerError`](#MongoServerError)
1920
- [`MongoSystemError`](#MongoSystemError)
@@ -38,7 +39,31 @@ There are four main error classes which stem from `MongoError`: `MongoDriverErro
3839

3940
The base class from which all errors in the Node driver subclass.
4041
`MongoError` should **never** be be directly instantiated.
41-
![(MongoError hierarchy tree)](../charts/imgs/MongoError.svg)
42+
43+
```mermaid
44+
graph TD
45+
MongoError --- MongoDriverError
46+
MongoError --- MongoNetworkError
47+
MongoError --- MongoServerError
48+
MongoError --- MongoSystemError
49+
MongoDriverError --- MongoAPIError
50+
MongoDriverError --- MongoRuntimeError
51+
52+
linkStyle 0 stroke:#116149
53+
linkStyle 1 stroke:#116149
54+
linkStyle 2 stroke:#116149
55+
linkStyle 3 stroke:#116149
56+
linkStyle 4 stroke:#116149
57+
linkStyle 5 stroke:#116149
58+
59+
style MongoError fill:#13aa52,stroke:#21313c,color:#FAFBFC
60+
style MongoSystemError fill:#13aa52,stroke:#21313c,color:#FAFBFC
61+
style MongoNetworkError fill:#13aa52,stroke:#21313c,color:#FAFBFC
62+
style MongoServerError fill:#13aa52,stroke:#21313c,color:#FAFBFC
63+
style MongoDriverError fill:#13aa52,stroke:#21313c,color:#FAFBFC
64+
style MongoAPIError fill:#13aa52,stroke:#21313c,color:#FAFBFC
65+
style MongoRuntimeError fill:#13aa52,stroke:#21313c,color:#FAFBFC
66+
```
4267

4368
Children of `MongoError` include:
4469

@@ -90,6 +115,15 @@ This class should **never** be directly instantiated.
90115
| **MongoChangeStreamError** | Thrown when an error is encountered when operating on a ChangeStream. |
91116
| **MongoGridFSStreamError** | Thrown when an unexpected state is reached when operating on a GridFS Stream. |
92117
| **MongoGridFSChunkError** | Thrown when a malformed or invalid chunk is encountered when reading from a GridFS Stream. |
118+
| **MongoUnexpectedServerResponseError** | Thrown when the driver receives a **parsable** response it did not expect from the server. |
119+
120+
### MongoUnexpectedServerResponseError
121+
122+
Intended for the scenario where the MongoDB returns an unexpected response in relation to some state the driver is in.
123+
This error should **NOT** represent a response that couldn't be parsed due to errors in protocol formatting.
124+
125+
Ex. Server selection results in a feature detection change: this is not usually an unexpected response, but if while retrying an operation serverSelection returns a server with a lower wireVersion than expected, we can no longer proceed with the retry, so the response is unexpected in that case.
126+
93127

94128
### `MongoNetworkError`
95129

0 commit comments

Comments
 (0)