payload: {"action":"created","issue":{"url":"https://api.github.com/repos/sequelize/sequelize/issues/1854","repository_url":"https://api.github.com/repos/sequelize/sequelize","labels_url":"https://api.github.com/repos/sequelize/sequelize/issues/1854/labels{/name}","comments_url":"https://api.github.com/repos/sequelize/sequelize/issues/1854/comments","events_url":"https://api.github.com/repos/sequelize/sequelize/issues/1854/events","html_url":"https://github.com/sequelize/sequelize/issues/1854","id":34895448,"node_id":"MDU6SXNzdWUzNDg5NTQ0OA==","number":1854,"title":"Database connection error handling","user":{"login":"shadone","id":25523,"node_id":"MDQ6VXNlcjI1NTIz","avatar_url":"https://avatars0.githubusercontent.com/u/25523?v=4","gravatar_id":"","url":"https://api.github.com/users/shadone","html_url":"https://github.com/shadone","followers_url":"https://api.github.com/users/shadone/followers","following_url":"https://api.github.com/users/shadone/following{/other_user}","gists_url":"https://api.github.com/users/shadone/gists{/gist_id}","starred_url":"https://api.github.com/users/shadone/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/shadone/subscriptions","organizations_url":"https://api.github.com/users/shadone/orgs","repos_url":"https://api.github.com/users/shadone/repos","events_url":"https://api.github.com/users/shadone/events{/privacy}","received_events_url":"https://api.github.com/users/shadone/received_events","type":"User","site_admin":false},"labels":[{"id":28979678,"node_id":"MDU6TGFiZWwyODk3OTY3OA==","url":"https://api.github.com/repos/sequelize/sequelize/labels/bug","name":"bug","color":"d7e102","default":true},{"id":28979733,"node_id":"MDU6TGFiZWwyODk3OTczMw==","url":"https://api.github.com/repos/sequelize/sequelize/labels/feature","name":"feature","color":"0b02e1","default":false}],"state":"closed","locked":false,"assignee":{"login":"janmeier","id":1210224,"node_id":"MDQ6VXNlcjEyMTAyMjQ=","avatar_url":"https://avatars3.githubusercontent.com/u/1210224?v=4","gravatar_id":"","url":"https://api.github.com/users/janmeier","html_url":"https://github.com/janmeier","followers_url":"https://api.github.com/users/janmeier/followers","following_url":"https://api.github.com/users/janmeier/following{/other_user}","gists_url":"https://api.github.com/users/janmeier/gists{/gist_id}","starred_url":"https://api.github.com/users/janmeier/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/janmeier/subscriptions","organizations_url":"https://api.github.com/users/janmeier/orgs","repos_url":"https://api.github.com/users/janmeier/repos","events_url":"https://api.github.com/users/janmeier/events{/privacy}","received_events_url":"https://api.github.com/users/janmeier/received_events","type":"User","site_admin":false},"assignees":[{"login":"janmeier","id":1210224,"node_id":"MDQ6VXNlcjEyMTAyMjQ=","avatar_url":"https://avatars3.githubusercontent.com/u/1210224?v=4","gravatar_id":"","url":"https://api.github.com/users/janmeier","html_url":"https://github.com/janmeier","followers_url":"https://api.github.com/users/janmeier/followers","following_url":"https://api.github.com/users/janmeier/following{/other_user}","gists_url":"https://api.github.com/users/janmeier/gists{/gist_id}","starred_url":"https://api.github.com/users/janmeier/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/janmeier/subscriptions","organizations_url":"https://api.github.com/users/janmeier/orgs","repos_url":"https://api.github.com/users/janmeier/repos","events_url":"https://api.github.com/users/janmeier/events{/privacy}","received_events_url":"https://api.github.com/users/janmeier/received_events","type":"User","site_admin":false}],"milestone":null,"comments":26,"created_at":"2014-06-03T19:20:05Z","updated_at":"2019-07-05T22:43:32Z","closed_at":"2014-12-04T15:47:34Z","author_association":"NONE","body":"Hi there,\n\nI've started using Sequelize just recently and one of the things missing for me is a way to detect database connection errors. I can see there is authenticate() function for establishing the initial connection to the db, however I cannot find any events / callbacks for handling errors afterwards - e.g. if the database (postgresql) is restarted my nodejs app simply crashes with the following exception:\n\n```\nevents.js:72\n        throw er; // Unhandled 'error' event\n              ^\nerror: terminating connection due to administrator command\n    at Connection.parseE (/Users/denis/dev/.../node_modules/pg/lib/connection.js:526:11)\n    at Connection.parseMessage (/Users/denis/dev/.../node_modules/pg/lib/connection.js:356:17)\n    at Socket.<anonymous> (/Users/denis/dev/.../node_modules/pg/lib/connection.js:105:22)\n    at Socket.EventEmitter.emit (events.js:95:17)\n    at Socket.<anonymous> (_stream_readable.js:746:14)\n    at Socket.EventEmitter.emit (events.js:92:17)\n    at emitReadable_ (_stream_readable.js:408:10)\n    at emitReadable (_stream_readable.js:404:5)\n    at readableAddChunk (_stream_readable.js:165:9)\n    at Socket.Readable.push (_stream_readable.js:127:10)\n```\n\nIs there a workaround for this?\n"},"comment":{"url":"https://api.github.com/repos/sequelize/sequelize/issues/comments/508875008","html_url":"https://github.com/sequelize/sequelize/issues/1854#issuecomment-508875008","issue_url":"https://api.github.com/repos/sequelize/sequelize/issues/1854","id":508875008,"node_id":"MDEyOklzc3VlQ29tbWVudDUwODg3NTAwOA==","user":{"login":"knoxcard","id":7561190,"node_id":"MDQ6VXNlcjc1NjExOTA=","avatar_url":"https://avatars0.githubusercontent.com/u/7561190?v=4","gravatar_id":"","url":"https://api.github.com/users/knoxcard","html_url":"https://github.com/knoxcard","followers_url":"https://api.github.com/users/knoxcard/followers","following_url":"https://api.github.com/users/knoxcard/following{/other_user}","gists_url":"https://api.github.com/users/knoxcard/gists{/gist_id}","starred_url":"https://api.github.com/users/knoxcard/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/knoxcard/subscriptions","organizations_url":"https://api.github.com/users/knoxcard/orgs","repos_url":"https://api.github.com/users/knoxcard/repos","events_url":"https://api.github.com/users/knoxcard/events{/privacy}","received_events_url":"https://api.github.com/users/knoxcard/received_events","type":"User","site_admin":false},"created_at":"2019-07-05T22:43:32Z","updated_at":"2019-07-05T22:43:32Z","author_association":"CONTRIBUTOR","body":"@sushantdhiman - i think this vital. I need Sequelize to emit an error connection problem the second it happens, any time during the program lifecycle.\r\n\r\n```\r\nconst sequelize = new Sequelize()\r\nsequelize.on('error', () => {\r\n   console.log('DB failed')\r\n   process.exit(0)\r\n})\r\n```"}}
other: {"actor":{"display_login":"knoxcard"}}