Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor(NODE-3291)!: Standardize error representation in the driver #2824

Merged
merged 37 commits into from
Jun 10, 2021

Conversation

dariakp
Copy link
Contributor

@dariakp dariakp commented May 28, 2021

Description

NODE-3291

BREAKING: Previously thrown TypeError instances have been converted to MongoDriverError instances and MongoParseError instances (which extend from the same class). Error names have changed to be more specific.

All thrown errors across the codebase have been converted to extend from a specific subclass of MongoError:

  • MongoServerError when wrapping errors returned from the server on specific queries,
  • MongoDriverError when generated by the driver,
  • MongoNetworkError when associated with a network connection failure,
  • MongoSystemError to represent errors associated with general system configuration.

@dariakp dariakp force-pushed the NODE-3291/standardize-error-representation branch 4 times, most recently from 296036d to a325f93 Compare May 28, 2021 21:09
@dariakp dariakp changed the title refactor: Replace TypeError with MongoParseError when validating connection options refactor(NODE-3291)!: Standardize error representation in the driver May 28, 2021
@dariakp dariakp force-pushed the NODE-3291/standardize-error-representation branch 11 times, most recently from 167dc52 to 8842ab9 Compare June 4, 2021 21:17
src/bulk/common.ts Outdated Show resolved Hide resolved
@dariakp dariakp requested a review from nbbeeken June 4, 2021 21:39
Copy link
Contributor

@nbbeeken nbbeeken left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I just have a number of clean up suggestions which some could be left to the follow up work that's coming up soon, I leave that to you to decide. There's on instance where a MongoError.create call's arguments were preserved where they need not be. Beyond that this is looking very ready to merge.

src/cmap/wire_protocol/compression.ts Show resolved Hide resolved
src/cmap/wire_protocol/compression.ts Show resolved Hide resolved
src/gridfs-stream/download.ts Outdated Show resolved Hide resolved
src/gridfs-stream/download.ts Outdated Show resolved Hide resolved
src/gridfs-stream/download.ts Show resolved Hide resolved
src/operations/eval.ts Outdated Show resolved Hide resolved
src/collection.ts Show resolved Hide resolved
src/error.ts Show resolved Hide resolved
src/sessions.ts Outdated Show resolved Hide resolved
@dariakp dariakp force-pushed the NODE-3291/standardize-error-representation branch from 8842ab9 to ed91110 Compare June 8, 2021 20:13
@nbbeeken nbbeeken marked this pull request as ready for review June 9, 2021 15:15
Copy link
Contributor

@nbbeeken nbbeeken left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

@nbbeeken nbbeeken requested review from a team, durran and emadum and removed request for a team June 9, 2021 15:16
@nbbeeken nbbeeken merged commit 9608c6a into 4.0 Jun 10, 2021
@nbbeeken nbbeeken deleted the NODE-3291/standardize-error-representation branch June 10, 2021 19:53
Copy link
Contributor

@emadum emadum left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
4 participants