-
Notifications
You must be signed in to change notification settings - Fork 642
Closed
Description
Thank you for all your good work on Objection!
After upgrading to Objection 2 the .onError() method has stopped working as intended.
When running this
const person = await Person.query()
.insert({
lastName: '', // this causes a validation error
})
.onError((e) => {
return 'error'
})
I expect
person === 'error'
Instead i get
person === undefined
Please see the following gist to reproduce this.
Running it with version 1 of objection
package.json
{
"dependencies": {
"chai": "4.2.0",
"knex": "0.20.13",
"objection": "1.6.11",
"sqlite3": "4.1.1"
}
}
Produces a success and we can see that the insert with on error successfully returns 'error'
Running it with version 2 of objection
package.json
{
"dependencies": {
"chai": "4.2.0",
"knex": "0.20.13",
"objection": "2.1.3",
"sqlite3": "4.1.1"
}
}
Produces an error for the expect and we can see the query did not return expected 'error' but instead returns undefined
gelotte, mattiassvedhem and PatrickLef
Metadata
Metadata
Assignees
Labels
No labels

