Closed cbarlow1993 closed 6 years ago
@cbarlow1993 Thanks for posting, we'll take a look as soon as possible.
For help with questions about Sails, click here. If you’re interested in hiring @sailsbot and her minions in Austin, click here.
Same issue here. Everything goes as a string inside the message attribute:
// console.log(err.message)
// typeof err.message === string
Unexpected error from database adapter: { [MongoError: E11000 duplicate key error index: kuaderno.student.$username_1 dup key: { : "redbird" }]
name: 'MongoError',
message: 'E11000 duplicate key error index: kuaderno.student.$username_1 dup key: { : "redbird" }',
driver: true,
index: 0,
code: 11000,
errmsg: 'E11000 duplicate key error index: kuaderno.student.$username_1 dup key: { : "redbird" }',
footprint: { identity: 'notUnique', keys: [] } }
// console.log(_.keys(err))
[ 'name', 'adapterMethodName', 'modelIdentity', 'raw' ]
// console.log(_.values(err))
[ 'AdapterError',
'update',
'student',
[Error: { [MongoError: E11000 duplicate key error index: kuaderno.student.$username_1 dup key: { : "redbird" }]
name: 'MongoError',
message: 'E11000 duplicate key error index: kuaderno.student.$username_1 dup key: { : "redbird" }',
driver: true,
index: 0,
code: 11000,
errmsg: 'E11000 duplicate key error index: kuaderno.student.$username_1 dup key: { : "redbird" }',
footprint: { identity: 'notUnique', keys: [] } }] ]
@cbarlow1993,@sailsbot,@Josebaseba: Hello, I'm a repo bot-- nice to meet you!
It has been 30 days since there have been any updates or new comments on this page. If this issue has been resolved, feel free to disregard the rest of this message and simply close the issue if possible. On the other hand, if you are still waiting on a patch, please post a comment to keep the thread alive (with any new information you can provide).
If no further activity occurs on this thread within the next 3 days, the issue will automatically be closed.
Thanks so much for your help!
ping @sgress454
Looking at this now...
@cbarlow1993 @Josebaseba This should be patched on master of sails-mongo
, if either of you would mind trying it out:
npm install github://balderdashy/sails-mongo
Hi @sgress454 it's working 👍 Could you please publish the 1.0.0-10
version of the mongo adapter (with the AVG fix and this fix too)? Thanks
And, is there any place where we can see all the error codes? I had to find them in the waterline code but maybe I'm missing more. In the docs, we only have the E_UNIQUE code: http://next.sailsjs.com/documentation/concepts/models-and-orm/errors
Thanks!!
@Josebaseba re: 1.0.0-10, done!
Re: error codes, I think E_UNIQUE
might be the only one right now. @mikermcneil?
@Josebaseba @sgress454 should be in the v1 docs now, if memory serves. E_UNIQUE is the only .code
which is relevant, for the most part-- though you'll also find usefulness in checking out .name
(which describes the broader classification)
Haven't had a chance to check the fix yet but I trust it works. Thanks @sgress454 & @mikermcneil for the fix.
@cbarlow1993 it works! And @mikermcneil thanks for the info 👍
@cbarlow1993,@sailsbot,@Josebaseba,@sgress454,@mikermcneil: Hello, I'm a repo bot-- nice to meet you!
It has been 30 days since there have been any updates or new comments on this page. If this issue has been resolved, feel free to disregard the rest of this message and simply close the issue if possible. On the other hand, if you are still waiting on a patch, please post a comment to keep the thread alive (with any new information you can provide).
If no further activity occurs on this thread within the next 3 days, the issue will automatically be closed.
Thanks so much for your help!
for future reference, docs about Waterline ORM errors now live at:
https://sailsjs.com/documentation/concepts/models-and-orm/errors
(^^ that link won't work for a few more days, but you can use the
next.
subdomain in the mean time)
Sails version: 1.0.0-36 Node version: v6.10.3 NPM version: 3.10.10 Operating system: Windows 10
As previously discussed on Gitter:
Sails hook: sails-hook-orm@2.0.0-21 Waterline: waterline@0.13.1-0 Sails-mongo: sails-mongo@1.0.0-9 Application running locally with
sails lift
. MongoDB deployed via Heroku on mongoLabs.I'm getting a strange error returned from MongoDB which is not as expected.
I have overridden a Blueprint create model as below and on attempt to register a user in the database of which the email already exists, I expect a duplicate error that I can handle, alternatively I get the outputs below.
Contact me @cbarlow1993 on gitter if needed.
return res.send(500).json(err)
will return :However, the
console.log(err)
returns:User model is: