{"action":"created","issue":{"url":"https://api.github.com/repos/sequelize/sequelize/issues/4435","labels_url":"https://api.github.com/repos/sequelize/sequelize/issues/4435/labels{/name}","comments_url":"https://api.github.com/repos/sequelize/sequelize/issues/4435/comments","events_url":"https://api.github.com/repos/sequelize/sequelize/issues/4435/events","html_url":"https://github.com/sequelize/sequelize/issues/4435","id":104898302,"number":4435,"title":"Don't call catch when upsert fails","user":{"login":"fabriciocs","id":5154393,"avatar_url":"https://avatars.githubusercontent.com/u/5154393?v=3","gravatar_id":"","url":"https://api.github.com/users/fabriciocs","html_url":"https://github.com/fabriciocs","followers_url":"https://api.github.com/users/fabriciocs/followers","following_url":"https://api.github.com/users/fabriciocs/following{/other_user}","gists_url":"https://api.github.com/users/fabriciocs/gists{/gist_id}","starred_url":"https://api.github.com/users/fabriciocs/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/fabriciocs/subscriptions","organizations_url":"https://api.github.com/users/fabriciocs/orgs","repos_url":"https://api.github.com/users/fabriciocs/repos","events_url":"https://api.github.com/users/fabriciocs/events{/privacy}","received_events_url":"https://api.github.com/users/fabriciocs/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":2,"created_at":"2015-09-04T14:11:22Z","updated_at":"2015-09-04T14:29:43Z","closed_at":"2015-09-04T14:29:43Z","body":"I have an express application, and the method below.\r\n```javascript\r\nrouter.post('/', app.checkAuthentication, function(req, res, next) {\r\n        service.save(req.body)\r\n            .then(function(result){\r\n                   res.json(result);\r\n            }).catch(function (err) {\r\n                throw err;\r\n            })\r\n    });\r\n\r\n```\r\n\r\nIn my service the method save is\r\n\r\n```javascript\r\n save: function (grupoPermissao) {\r\n            return model.Sequelize().transaction(function (t) {\r\n                return model.upsert(grupoPermissao, {transaction: t});\r\n            });\r\n        },\r\n````\r\n\r\nwhen some validation fails, i have in console:\r\n\r\n```javascript\r\nExecuting (427fae74-8395-43b9-844a-fb5d7b24c76c): START TRANSACTION;\r\nExecuting (427fae74-8395-43b9-844a-fb5d7b24c76c): SET SESSION TRANSACTION ISOLATION LEVEL REPEATABLE READ;\r\nExecuting (427fae74-8395-43b9-844a-fb5d7b24c76c): SET autocommit = 1;\r\nExecuting (427fae74-8395-43b9-844a-fb5d7b24c76c): ROLLBACK;\r\nUnhandled rejection SequelizeValidationError: notNull Violation: grp_nome cannot be null\r\n    at D:\\PhD\\Projetos\\Gerenciamento de Risco\\gr-admin\\node_modules\\sequelize\\lib\\instance-validator.js:72:14\r\n    at tryCatcher (D:\\PhD\\Projetos\\Gerenciamento de Risco\\gr-admin\\node_modules\\sequelize\\node_modules\\bluebird\\js\\main\\util.js:26:23)\r\n    at Promise._settlePromiseFromHandler (D:\\PhD\\Projetos\\Gerenciamento de Risco\\gr-admin\\node_modules\\sequelize\\node_modules\\bluebird\\js\\main\\promise.js:503:31)\r\n    at Promise._settlePromiseAt (D:\\PhD\\Projetos\\Gerenciamento de Risco\\gr-admin\\node_modules\\sequelize\\node_modules\\bluebird\\js\\main\\promise.js:577:18)\r\n    at Promise._settlePromiseAtPostResolution (D:\\PhD\\Projetos\\Gerenciamento de Risco\\gr-admin\\node_modules\\sequelize\\node_modules\\bluebird\\js\\main\\promise.js:244:10)\r\n    at Async._drainQueue (D:\\PhD\\Projetos\\Gerenciamento de Risco\\gr-admin\\node_modules\\sequelize\\node_modules\\bluebird\\js\\main\\async.js:128:12)\r\n    at Async._drainQueues (D:\\PhD\\Projetos\\Gerenciamento de Risco\\gr-admin\\node_modules\\sequelize\\node_modules\\bluebird\\js\\main\\async.js:133:10)\r\n    at Immediate.Async.drainQueues [as _onImmediate] (D:\\PhD\\Projetos\\Gerenciamento de Risco\\gr-admin\\node_modules\\sequelize\\node_modules\\bluebird\\js\\main\\async.js:15:14)\r\n    at processImmediate [as _immediateCallback] (timers.js:358:17)\r\n```\r\n\r\nbut, the catch block in my express route, is never called.\r\n\r\nHow can i solve this?"},"comment":{"url":"https://api.github.com/repos/sequelize/sequelize/issues/comments/137750822","html_url":"https://github.com/sequelize/sequelize/issues/4435#issuecomment-137750822","issue_url":"https://api.github.com/repos/sequelize/sequelize/issues/4435","id":137750822,"user":{"login":"fabriciocs","id":5154393,"avatar_url":"https://avatars.githubusercontent.com/u/5154393?v=3","gravatar_id":"","url":"https://api.github.com/users/fabriciocs","html_url":"https://github.com/fabriciocs","followers_url":"https://api.github.com/users/fabriciocs/followers","following_url":"https://api.github.com/users/fabriciocs/following{/other_user}","gists_url":"https://api.github.com/users/fabriciocs/gists{/gist_id}","starred_url":"https://api.github.com/users/fabriciocs/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/fabriciocs/subscriptions","organizations_url":"https://api.github.com/users/fabriciocs/orgs","repos_url":"https://api.github.com/users/fabriciocs/repos","events_url":"https://api.github.com/users/fabriciocs/events{/privacy}","received_events_url":"https://api.github.com/users/fabriciocs/received_events","type":"User","site_admin":false},"created_at":"2015-09-04T14:29:43Z","updated_at":"2015-09-04T14:29:43Z","body":"thank you, i changed to \r\n```javascript\r\n service.save(req.body)\r\n            .then(function(result){\r\n                res.json(result);\r\n            }).catch(function (err) {\r\n                next(err);\r\n            })\r\n```\r\n\r\nAnd it works.\r\n"}}