-
Notifications
You must be signed in to change notification settings - Fork 5.2k
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
Issue #13121 updated the error handling within the Meteor method for… #13124
base: devel
Are you sure you want to change the base?
Conversation
…d for inserting data into a MongoDB collection
|
const indexName = match ? match[1] : 'unknown'; | ||
|
||
// Throw a specific Meteor.Error with the index name | ||
throw new Meteor.Error(409, `Duplicate key error on index: ${indexName}`); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please format this properly. Running this through a linter should fix this automatically.
Hello @Sageyuva before we proceed further please sign the CLA as per the link in the automated comment above. Thank you! |
Hi @Sageyuva please sign the CLA or we will have to reject your PR. |
// for old versions of MongoDB (probably not necessary but it's here just in case) | ||
e.name === 'BulkWriteError' || | ||
// for newer versions of MongoDB (https://docs.mongodb.com/drivers/node/current/whats-new/#bulkwriteerror---mongobulkwriteerror) | ||
e.name === 'MongoBulkWriteError' || | ||
e.name === 'MinimongoError' | ||
) { | ||
throw new Meteor.Error(409, e.toString()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This doesn't feel quite right.
The implementation changes from a generic error-throwing approach for incoming messages to a specific one that only throws errors related to indexes. Something feels off or unclear.
… inserting data into a MongoDB collection