{"action":"created","issue":{"url":"https://api.github.com/repos/tgriesser/knex/issues/522","repository_url":"https://api.github.com/repos/tgriesser/knex","labels_url":"https://api.github.com/repos/tgriesser/knex/issues/522/labels{/name}","comments_url":"https://api.github.com/repos/tgriesser/knex/issues/522/comments","events_url":"https://api.github.com/repos/tgriesser/knex/issues/522/events","html_url":"https://github.com/tgriesser/knex/issues/522","id":45264120,"number":522,"title":"Discussion: Error Handling","user":{"login":"tgriesser","id":154748,"avatar_url":"https://avatars.githubusercontent.com/u/154748?v=3","gravatar_id":"","url":"https://api.github.com/users/tgriesser","html_url":"https://github.com/tgriesser","followers_url":"https://api.github.com/users/tgriesser/followers","following_url":"https://api.github.com/users/tgriesser/following{/other_user}","gists_url":"https://api.github.com/users/tgriesser/gists{/gist_id}","starred_url":"https://api.github.com/users/tgriesser/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tgriesser/subscriptions","organizations_url":"https://api.github.com/users/tgriesser/orgs","repos_url":"https://api.github.com/users/tgriesser/repos","events_url":"https://api.github.com/users/tgriesser/events{/privacy}","received_events_url":"https://api.github.com/users/tgriesser/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/tgriesser/knex/labels/discussion","name":"discussion","color":"bfd4f2"}],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":9,"created_at":"2014-10-08T16:17:34Z","updated_at":"2016-08-02T07:58:11Z","closed_at":null,"body":"I'm still experiencing some disconnect issues in MySQL on timeout errors. We should carefully think out the standard error handling behavior and / have some default options and custom errors for the different potential cases that can happen among different databases.\r\n\r\nOpening this ticket as a single place to discuss anything error related and reference any error related behavior."},"comment":{"url":"https://api.github.com/repos/tgriesser/knex/issues/comments/236830869","html_url":"https://github.com/tgriesser/knex/issues/522#issuecomment-236830869","issue_url":"https://api.github.com/repos/tgriesser/knex/issues/522","id":236830869,"user":{"login":"elhigu","id":696345,"avatar_url":"https://avatars.githubusercontent.com/u/696345?v=3","gravatar_id":"","url":"https://api.github.com/users/elhigu","html_url":"https://github.com/elhigu","followers_url":"https://api.github.com/users/elhigu/followers","following_url":"https://api.github.com/users/elhigu/following{/other_user}","gists_url":"https://api.github.com/users/elhigu/gists{/gist_id}","starred_url":"https://api.github.com/users/elhigu/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/elhigu/subscriptions","organizations_url":"https://api.github.com/users/elhigu/orgs","repos_url":"https://api.github.com/users/elhigu/repos","events_url":"https://api.github.com/users/elhigu/events{/privacy}","received_events_url":"https://api.github.com/users/elhigu/received_events","type":"User","site_admin":false},"created_at":"2016-08-02T07:58:11Z","updated_at":"2016-08-02T07:58:11Z","body":"@williscool In knex there is connection pool, which is pinging connections in the pool every now and then if the certain pool connection is alive. If connection is in pool and it dies, then it is just discarded. \r\n\r\nSo there is no need for ready event, since for every query connection is requested from pool. In pool you have afterConnectionInit or something like that method, which can be used to run some initial queries when new database connection is created for the first time.\r\n\r\n`knex.on('query-error', function (err) {...})` event can be used globally to get any connection / and other errors.\r\n\r\nAnd here are some error scenarios I can think of:\r\n\r\nDisconnected event is not interesting for the knex, since pool decides when connections are created / discarded.\r\n\r\nIf connection is outside of the pool (e.g. bound for certain transaction) and one is doing query there and connection is lost, then probably query timeout or some other error is returned from promise. \r\n\r\nIf one tries to get connection from pool and there are none available, then after timeout connection acquire timeout error is thrown.\r\n\r\nIt is pretty much impossible to create events like redis have for knex because of multitude of different db drivers which doesn't actually support listening for connection errors (sorry I don't remember the details of that from top of my head, @wubzz might remember)...  \r\n"}}
{"actor":{"display_login":"elhigu"}}