{"action":"created","issue":{"url":"https://api.github.com/repos/OrbitzWorldwide/consul-client/issues/173","repository_url":"https://api.github.com/repos/OrbitzWorldwide/consul-client","labels_url":"https://api.github.com/repos/OrbitzWorldwide/consul-client/issues/173/labels{/name}","comments_url":"https://api.github.com/repos/OrbitzWorldwide/consul-client/issues/173/comments","events_url":"https://api.github.com/repos/OrbitzWorldwide/consul-client/issues/173/events","html_url":"https://github.com/OrbitzWorldwide/consul-client/issues/173","id":182771972,"number":173,"title":"behavior change : ConsulResponseCallback#onFailure now called in case entry does not exists","user":{"login":"YannRobert","id":1653590,"avatar_url":"https://avatars.githubusercontent.com/u/1653590?v=3","gravatar_id":"","url":"https://api.github.com/users/YannRobert","html_url":"https://github.com/YannRobert","followers_url":"https://api.github.com/users/YannRobert/followers","following_url":"https://api.github.com/users/YannRobert/following{/other_user}","gists_url":"https://api.github.com/users/YannRobert/gists{/gist_id}","starred_url":"https://api.github.com/users/YannRobert/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/YannRobert/subscriptions","organizations_url":"https://api.github.com/users/YannRobert/orgs","repos_url":"https://api.github.com/users/YannRobert/repos","events_url":"https://api.github.com/users/YannRobert/events{/privacy}","received_events_url":"https://api.github.com/users/YannRobert/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":2,"created_at":"2016-10-13T12:08:51Z","updated_at":"2016-10-18T11:56:03Z","closed_at":null,"body":"Today I tested an upgrade \r\nto latest ```0.13.1```\r\nfrom version ```0.12.3```\r\n\r\nand I found a change in behavior of the lib : \r\n\r\nWhen watching for change on an entry, \r\nPreviously, the lib was calling ```com.orbitz.consul.async.ConsulResponseCallback#onComplete```\r\neven when the server returns a HTTP status ```404```\r\nNow, the lib is calling ```com.orbitz.consul.async.ConsulResponseCallback#onFailure```.\r\n\r\nI am not sure that a ```404``` means a failure.\r\nIt seems to me it just means that the entry does not exists, which is not a failure, just a possible functional case. \r\n\r\nPreviously, I was checking ```consulResponse.getResponse().isPresent()``` that was false in case of a ```404```. \r\n\r\nImagine the case when a configuration entry is present for a while, then it is removed from Consul. The application needs to be notified that the entry was removed. Hence the call to ```com.orbitz.consul.async.ConsulResponseCallback#onComplete```.\r\n\r\n```com.orbitz.consul.async.ConsulResponseCallback#onFailure``` is now called in case of a ```404```, the following parameter : ```com.orbitz.consul.ConsulException: Consul request failed with status [404]:  ```\r\n\r\nThe ```ConsulException``` does tell it is a ```404``` in the message, but this is a fragile way to tell the application about a functional case. The message could change in the future, then an application cannot rely on it to tell a ```404``` from any other error.\r\n\r\nWe should either make the lib : \r\n- call ```com.orbitz.consul.async.ConsulResponseCallback#onComplete``` like it was before\r\n- or provide an actionable way to distinguish the functional case ```404 NOT FOUND``` from the ```Thowable``` passed to ```com.orbitz.consul.async.ConsulResponseCallback#onFailure```\r\n\r\nI think I prefer the first solution."},"comment":{"url":"https://api.github.com/repos/OrbitzWorldwide/consul-client/issues/comments/254485746","html_url":"https://github.com/OrbitzWorldwide/consul-client/issues/173#issuecomment-254485746","issue_url":"https://api.github.com/repos/OrbitzWorldwide/consul-client/issues/173","id":254485746,"user":{"login":"rickfast","id":295068,"avatar_url":"https://avatars.githubusercontent.com/u/295068?v=3","gravatar_id":"","url":"https://api.github.com/users/rickfast","html_url":"https://github.com/rickfast","followers_url":"https://api.github.com/users/rickfast/followers","following_url":"https://api.github.com/users/rickfast/following{/other_user}","gists_url":"https://api.github.com/users/rickfast/gists{/gist_id}","starred_url":"https://api.github.com/users/rickfast/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rickfast/subscriptions","organizations_url":"https://api.github.com/users/rickfast/orgs","repos_url":"https://api.github.com/users/rickfast/repos","events_url":"https://api.github.com/users/rickfast/events{/privacy}","received_events_url":"https://api.github.com/users/rickfast/received_events","type":"User","site_admin":false},"created_at":"2016-10-18T11:56:03Z","updated_at":"2016-10-18T11:56:03Z","body":"I'll see if I can get a fix in for this today"}}
{"actor":{"display_login":"rickfast"}}