-
Notifications
You must be signed in to change notification settings - Fork 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
Waterline or sails-mongo does not catch some MongoDB exceptions #7265
Comments
@anselmo-coolstay Thanks for posting! We'll take a look as soon as possible. In the mean time, there are a few ways you can help speed things along:
Please remember: never post in a public forum if you believe you've found a genuine security vulnerability. Instead, disclose it responsibly. For help with questions about Sails, click here. |
Hi @anselmo-coolstay, would you be able to share an example of the code where you're seeing this issue? |
Sorry, it was my mistake. My code was like below: try {
Inventory.findOrCreate({ date }, inputs).exec(async (err, result, wasCreated) => {
if (err) {
...
} else if (wasCreated) {
return exits.success(result);
}
return await Inventory.updateOne({ id: result?.id }).set(clonedInputs);
});
} catch (ex) {
return exits.error(ex);
} The above code was wrong. Try - catch statement should be placed inside of findOrCreate callback function, but I placed it outside of that. |
Node version: 16.18.1
Sails version (sails): 1.5.2
ORM hook version (sails-hook-orm): 4.0.1
Sockets hook version (sails-hook-sockets): 2.0.1
Organics hook version (sails-hook-organics): N/A
Grunt hook version (sails-hook-grunt): 5.0.0
Uploads hook version (sails-hook-uploads): N/A
DB adapter & version (e.g. sails-mysql@5.55.5): sails-mongo@2.0.0
Skipper adapter & version (e.g. skipper-s3@5.55.5): N/A
I received the below error message:
Waterline or sails-mongo seems not to catch this exception. So I should wait timeout in this request.
Could you fix it, please?
The text was updated successfully, but these errors were encountered: