Skip to content

Commit 6984fca

Browse files
committed
fix(NODE-3769): align retryable error logic with spec
1 parent 4390819 commit 6984fca

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

42 files changed

+991
-759
lines changed

.eslintrc.json

+6-1
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
{

.evergreen/run-kms-servers.sh

+3-3
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,6 @@ cd ${DRIVERS_TOOLS}/.evergreen/csfle
22
. ./activate_venv.sh
33
# by default it always runs on port 5698
44
./kmstlsvenv/bin/python3 -u kms_kmip_server.py &
5-
./kmstlsvenv/bin/python3 -u kms_http_server.py --ca_file ../x509gen/ca.pem --cert_file ../x509gen/expired.pem --port 8000 &
6-
./kmstlsvenv/bin/python3 -u kms_http_server.py --ca_file ../x509gen/ca.pem --cert_file ../x509gen/wrong-host.pem --port 8001 &
7-
./kmstlsvenv/bin/python3 -u kms_http_server.py --ca_file ../x509gen/ca.pem --cert_file ../x509gen/server.pem --port 8002 --require_client_cert &
5+
./kmstlsvenv/bin/python3 -u kms_http_server.py --ca_file ../x509gen/ca.pem --cert_file ../x509gen/expired.pem --port 9000 &
6+
./kmstlsvenv/bin/python3 -u kms_http_server.py --ca_file ../x509gen/ca.pem --cert_file ../x509gen/wrong-host.pem --port 9001 &
7+
./kmstlsvenv/bin/python3 -u kms_http_server.py --ca_file ../x509gen/ca.pem --cert_file ../x509gen/server.pem --port 9002 --require_client_cert &

.evergreen/run-tests.sh

+1-1
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ else
4747
source "$DRIVERS_TOOLS"/.evergreen/csfle/set-temp-creds.sh
4848
fi
4949

50-
npm install mongodb-client-encryption@">=2.0.0-beta.4"
50+
npm install mongodb-client-encryption
5151

5252
export AUTH=$AUTH
5353
export SINGLE_MONGOS_LB_URI=${SINGLE_MONGOS_LB_URI}

etc/charts/README.md

-11
This file was deleted.

etc/charts/build_images.sh

-13
This file was deleted.

etc/charts/imgs/MongoError.svg

-1
This file was deleted.

etc/charts/mermaid/MongoError.mmd

-22
This file was deleted.

etc/notes/errors.md

+35-1
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)