Skip to content

Commit

Permalink
Merge pull request #13279 from Ankit-Mandal/patch-1
Browse files Browse the repository at this point in the history
Updated formatting of Error Handling section to better highlight the …
  • Loading branch information
vkarpov15 committed Apr 18, 2023
2 parents e411825 + b865429 commit 717fe24
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions docs/connections.md
Original file line number Diff line number Diff line change
Expand Up @@ -95,8 +95,8 @@ await Model.createCollection();

There are two classes of errors that can occur with a Mongoose connection.

- Error on initial connection. If initial connection fails, Mongoose will emit an 'error' event and the promise `mongoose.connect()` returns will reject. However, Mongoose will **not** automatically try to reconnect.
- Error after initial connection was established. Mongoose will attempt to reconnect, and it will emit an 'error' event.
- **Error on initial connection**: If initial connection fails, Mongoose will emit an 'error' event and the promise `mongoose.connect()` returns will reject. However, Mongoose will **not** automatically try to reconnect.
- **Error after initial connection was established**: Mongoose will attempt to reconnect, and it will emit an 'error' event.

To handle initial connection errors, you should use `.catch()` or `try/catch` with async/await.

Expand Down

0 comments on commit 717fe24

Please sign in to comment.