Skip to content

Commit

Permalink
fix(NODE-3769): retryable writes are not compliant with specification (
Browse files Browse the repository at this point in the history
  • Loading branch information
nbbeeken committed Mar 14, 2022
1 parent 6f633d1 commit ff26b12
Show file tree
Hide file tree
Showing 33 changed files with 922 additions and 753 deletions.
7 changes: 6 additions & 1 deletion .eslintrc.json
Expand Up @@ -66,6 +66,10 @@
{
"name": ".",
"message": "Please import directly from the relevant file instead."
},
{
"name": "..",
"message": "Please import directly from the relevant file instead."
}
]
}
Expand Down Expand Up @@ -158,7 +162,8 @@
"parser": "@typescript-eslint/parser",
"rules": {
"no-console": "off",
"no-restricted-syntax": "off"
"no-restricted-syntax": "off",
"typescript-eslint/ban-ts-comment": "off"
}
},
{
Expand Down
11 changes: 0 additions & 11 deletions etc/charts/README.md

This file was deleted.

13 changes: 0 additions & 13 deletions etc/charts/build_images.sh

This file was deleted.

1 change: 0 additions & 1 deletion etc/charts/imgs/MongoError.svg

This file was deleted.

22 changes: 0 additions & 22 deletions etc/charts/mermaid/MongoError.mmd

This file was deleted.

36 changes: 35 additions & 1 deletion etc/notes/errors.md
Expand Up @@ -14,6 +14,7 @@
- [`MongoDriverError`](#MongoDriverError)
- [`MongoAPIError`](#MongoAPIError)
- [`MongoRuntimeError`](#MongoRuntimeError)
- [`MongoUnexpectedServerResponseError`](#MongoUnexpectedServerResponseError)
- [`MongoNetworkError`](#MongoNetworkError)
- [`MongoServerError`](#MongoServerError)
- [`MongoSystemError`](#MongoSystemError)
Expand All @@ -38,7 +39,31 @@ There are four main error classes which stem from `MongoError`: `MongoDriverErro

The base class from which all errors in the Node driver subclass.
`MongoError` should **never** be be directly instantiated.
![(MongoError hierarchy tree)](../charts/imgs/MongoError.svg)

```mermaid
graph TD
MongoError --- MongoDriverError
MongoError --- MongoNetworkError
MongoError --- MongoServerError
MongoError --- MongoSystemError
MongoDriverError --- MongoAPIError
MongoDriverError --- MongoRuntimeError
linkStyle 0 stroke:#116149
linkStyle 1 stroke:#116149
linkStyle 2 stroke:#116149
linkStyle 3 stroke:#116149
linkStyle 4 stroke:#116149
linkStyle 5 stroke:#116149
style MongoError fill:#13aa52,stroke:#21313c,color:#FAFBFC
style MongoSystemError fill:#13aa52,stroke:#21313c,color:#FAFBFC
style MongoNetworkError fill:#13aa52,stroke:#21313c,color:#FAFBFC
style MongoServerError fill:#13aa52,stroke:#21313c,color:#FAFBFC
style MongoDriverError fill:#13aa52,stroke:#21313c,color:#FAFBFC
style MongoAPIError fill:#13aa52,stroke:#21313c,color:#FAFBFC
style MongoRuntimeError fill:#13aa52,stroke:#21313c,color:#FAFBFC
```

Children of `MongoError` include:

Expand Down Expand Up @@ -90,6 +115,15 @@ This class should **never** be directly instantiated.
| **MongoChangeStreamError** | Thrown when an error is encountered when operating on a ChangeStream. |
| **MongoGridFSStreamError** | Thrown when an unexpected state is reached when operating on a GridFS Stream. |
| **MongoGridFSChunkError** | Thrown when a malformed or invalid chunk is encountered when reading from a GridFS Stream. |
| **MongoUnexpectedServerResponseError** | Thrown when the driver receives a **parsable** response it did not expect from the server. |

### MongoUnexpectedServerResponseError

Intended for the scenario where the MongoDB returns an unexpected response in relation to some state the driver is in.
This error should **NOT** represent a response that couldn't be parsed due to errors in protocol formatting.

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.


### `MongoNetworkError`

Expand Down

0 comments on commit ff26b12

Please sign in to comment.