{"action":"created","issue":{"url":"https://api.github.com/repos/Esri/esri-leaflet/issues/575","labels_url":"https://api.github.com/repos/Esri/esri-leaflet/issues/575/labels{/name}","comments_url":"https://api.github.com/repos/Esri/esri-leaflet/issues/575/comments","events_url":"https://api.github.com/repos/Esri/esri-leaflet/issues/575/events","html_url":"https://github.com/Esri/esri-leaflet/issues/575","id":93576229,"number":575,"title":"metadata requests with an invalid token don't trigger the callback","user":{"login":"jgravois","id":3011734,"avatar_url":"https://avatars.githubusercontent.com/u/3011734?v=3","gravatar_id":"","url":"https://api.github.com/users/jgravois","html_url":"https://github.com/jgravois","followers_url":"https://api.github.com/users/jgravois/followers","following_url":"https://api.github.com/users/jgravois/following{/other_user}","gists_url":"https://api.github.com/users/jgravois/gists{/gist_id}","starred_url":"https://api.github.com/users/jgravois/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jgravois/subscriptions","organizations_url":"https://api.github.com/users/jgravois/orgs","repos_url":"https://api.github.com/users/jgravois/repos","events_url":"https://api.github.com/users/jgravois/events{/privacy}","received_events_url":"https://api.github.com/users/jgravois/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":5,"created_at":"2015-07-07T16:45:38Z","updated_at":"2015-07-07T18:40:51Z","closed_at":null,"body":"```js\r\nL.esri.Services.service({\r\n  url: 'http://logistics.arcgis.com/arcgis/rest/services/World/ServiceAreas/GPServer/GenerateServiceAreas',\r\n  token: 'badtoken'\r\n}).metadata(function(error, response){\r\n  // never triggered\r\n  console.log(error);\r\n});\r\n```\r\nthis is because we currently:\r\n 1. trap authentication errors\r\n 2. push into `_requestQueue`\r\n 3. intentionally don't call the callback.\r\n\r\n(code [here](https://github.com/Esri/esri-leaflet/blob/master/src/Services/Service.js#L73-L80))\r\n\r\ni don't know enough about the other use case we are trying to support to know if/how we can best 'fix' this problem.  i was just surprised to see the error swallowed while working on jgravois/esri-leaflet-gp/issues/17"},"comment":{"url":"https://api.github.com/repos/Esri/esri-leaflet/issues/comments/119297696","html_url":"https://github.com/Esri/esri-leaflet/issues/575#issuecomment-119297696","issue_url":"https://api.github.com/repos/Esri/esri-leaflet/issues/575","id":119297696,"user":{"login":"patrickarlt","id":378557,"avatar_url":"https://avatars.githubusercontent.com/u/378557?v=3","gravatar_id":"","url":"https://api.github.com/users/patrickarlt","html_url":"https://github.com/patrickarlt","followers_url":"https://api.github.com/users/patrickarlt/followers","following_url":"https://api.github.com/users/patrickarlt/following{/other_user}","gists_url":"https://api.github.com/users/patrickarlt/gists{/gist_id}","starred_url":"https://api.github.com/users/patrickarlt/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/patrickarlt/subscriptions","organizations_url":"https://api.github.com/users/patrickarlt/orgs","repos_url":"https://api.github.com/users/patrickarlt/repos","events_url":"https://api.github.com/users/patrickarlt/events{/privacy}","received_events_url":"https://api.github.com/users/patrickarlt/received_events","type":"User","site_admin":false},"created_at":"2015-07-07T18:40:51Z","updated_at":"2015-07-07T18:40:51Z","body":">  guessing that just because my own scenario doesn't result in a callback being called twice, there are others that would if we made any changes to the logic.\r\n\r\nOk assume that your callback is called with an error code 498 token required. What do you do? You  obviously want to try to request again but how do you do that? How do you try to request again without calling the users callback twice or making the user repeat the request again? Remember that in most cases like `L.esri.FeatureLayer` the user doesn't know anything about the requests since they are all handled internally."}}