{"action":"created","issue":{"url":"https://api.github.com/repos/expressjs/express/issues/3604","repository_url":"https://api.github.com/repos/expressjs/express","labels_url":"https://api.github.com/repos/expressjs/express/issues/3604/labels{/name}","comments_url":"https://api.github.com/repos/expressjs/express/issues/3604/comments","events_url":"https://api.github.com/repos/expressjs/express/issues/3604/events","html_url":"https://github.com/expressjs/express/issues/3604","id":308325491,"number":3604,"title":"Support catching rejected promises in middleware functions","user":{"login":"ORESoftware","id":11139560,"avatar_url":"https://avatars1.githubusercontent.com/u/11139560?v=4","gravatar_id":"","url":"https://api.github.com/users/ORESoftware","html_url":"https://github.com/ORESoftware","followers_url":"https://api.github.com/users/ORESoftware/followers","following_url":"https://api.github.com/users/ORESoftware/following{/other_user}","gists_url":"https://api.github.com/users/ORESoftware/gists{/gist_id}","starred_url":"https://api.github.com/users/ORESoftware/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ORESoftware/subscriptions","organizations_url":"https://api.github.com/users/ORESoftware/orgs","repos_url":"https://api.github.com/users/ORESoftware/repos","events_url":"https://api.github.com/users/ORESoftware/events{/privacy}","received_events_url":"https://api.github.com/users/ORESoftware/received_events","type":"User","site_admin":false},"labels":[{"id":55442290,"url":"https://api.github.com/repos/expressjs/express/labels/duplicate","name":"duplicate","color":"cccccc","default":true}],"state":"closed","locked":false,"assignee":{"login":"dougwilson","id":67512,"avatar_url":"https://avatars3.githubusercontent.com/u/67512?v=4","gravatar_id":"","url":"https://api.github.com/users/dougwilson","html_url":"https://github.com/dougwilson","followers_url":"https://api.github.com/users/dougwilson/followers","following_url":"https://api.github.com/users/dougwilson/following{/other_user}","gists_url":"https://api.github.com/users/dougwilson/gists{/gist_id}","starred_url":"https://api.github.com/users/dougwilson/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dougwilson/subscriptions","organizations_url":"https://api.github.com/users/dougwilson/orgs","repos_url":"https://api.github.com/users/dougwilson/repos","events_url":"https://api.github.com/users/dougwilson/events{/privacy}","received_events_url":"https://api.github.com/users/dougwilson/received_events","type":"User","site_admin":false},"assignees":[{"login":"dougwilson","id":67512,"avatar_url":"https://avatars3.githubusercontent.com/u/67512?v=4","gravatar_id":"","url":"https://api.github.com/users/dougwilson","html_url":"https://github.com/dougwilson","followers_url":"https://api.github.com/users/dougwilson/followers","following_url":"https://api.github.com/users/dougwilson/following{/other_user}","gists_url":"https://api.github.com/users/dougwilson/gists{/gist_id}","starred_url":"https://api.github.com/users/dougwilson/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dougwilson/subscriptions","organizations_url":"https://api.github.com/users/dougwilson/orgs","repos_url":"https://api.github.com/users/dougwilson/repos","events_url":"https://api.github.com/users/dougwilson/events{/privacy}","received_events_url":"https://api.github.com/users/dougwilson/received_events","type":"User","site_admin":false}],"milestone":null,"comments":6,"created_at":"2018-03-25T06:11:38Z","updated_at":"2018-03-25T19:13:30Z","closed_at":"2018-03-25T19:08:28Z","author_association":"NONE","body":"I discovered this:\r\n\r\nhttps://medium.com/@the1mills/hacking-express-to-support-returned-promises-in-middleware-9487251ca124\r\n\r\nseems to work so far. I looked at the latest releases of Express 4 and 5, and doesn't seem to be supported.\r\n\r\nWould it be possible to handle returned promises in middleware functions - at least if the promise is rejected? \r\n"},"comment":{"url":"https://api.github.com/repos/expressjs/express/issues/comments/375995407","html_url":"https://github.com/expressjs/express/issues/3604#issuecomment-375995407","issue_url":"https://api.github.com/repos/expressjs/express/issues/3604","id":375995407,"user":{"login":"ORESoftware","id":11139560,"avatar_url":"https://avatars1.githubusercontent.com/u/11139560?v=4","gravatar_id":"","url":"https://api.github.com/users/ORESoftware","html_url":"https://github.com/ORESoftware","followers_url":"https://api.github.com/users/ORESoftware/followers","following_url":"https://api.github.com/users/ORESoftware/following{/other_user}","gists_url":"https://api.github.com/users/ORESoftware/gists{/gist_id}","starred_url":"https://api.github.com/users/ORESoftware/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ORESoftware/subscriptions","organizations_url":"https://api.github.com/users/ORESoftware/orgs","repos_url":"https://api.github.com/users/ORESoftware/repos","events_url":"https://api.github.com/users/ORESoftware/events{/privacy}","received_events_url":"https://api.github.com/users/ORESoftware/received_events","type":"User","site_admin":false},"created_at":"2018-03-25T19:13:30Z","updated_at":"2018-03-25T19:13:30Z","author_association":"NONE","body":"Sounds good.\r\n\r\nYeah you shouldn't automatically call next for the user, here is why:\r\n\r\n```\r\nrouter.use('/foo', function(req,res,next){\r\n   return Promise.resolve().then(function(){\r\n         doSomeCallbackThing(function(err, v){\r\n                err ? res.json({error:err}) : res.json({success: v || null});\r\n         });\r\n    });\r\n});\r\n```\r\n\r\nif `next()` is called automatically for the user then `doSomeCallbackThing` won't have time to complete, etc etc."}}
{"actor":{"display_login":"ORESoftware"}}