{"action":"opened","issue":{"url":"https://api.github.com/repos/CICCIOSGAMINO/openweather-apis/issues/1","labels_url":"https://api.github.com/repos/CICCIOSGAMINO/openweather-apis/issues/1/labels{/name}","comments_url":"https://api.github.com/repos/CICCIOSGAMINO/openweather-apis/issues/1/comments","events_url":"https://api.github.com/repos/CICCIOSGAMINO/openweather-apis/issues/1/events","html_url":"https://github.com/CICCIOSGAMINO/openweather-apis/issues/1","id":69917820,"number":1,"title":"Unexpected token","user":{"login":"dagalufh","id":8938352,"avatar_url":"https://avatars.githubusercontent.com/u/8938352?v=3","gravatar_id":"","url":"https://api.github.com/users/dagalufh","html_url":"https://github.com/dagalufh","followers_url":"https://api.github.com/users/dagalufh/followers","following_url":"https://api.github.com/users/dagalufh/following{/other_user}","gists_url":"https://api.github.com/users/dagalufh/gists{/gist_id}","starred_url":"https://api.github.com/users/dagalufh/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dagalufh/subscriptions","organizations_url":"https://api.github.com/users/dagalufh/orgs","repos_url":"https://api.github.com/users/dagalufh/repos","events_url":"https://api.github.com/users/dagalufh/events{/privacy}","received_events_url":"https://api.github.com/users/dagalufh/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":0,"created_at":"2015-04-21T18:27:58Z","updated_at":"2015-04-21T18:27:58Z","closed_at":null,"body":"Hi\r\n\r\nI have a node.js script that uses your plugin but i once in a while get the below error:\r\n\r\nThe calling code looks like this:\r\n<code>\r\n                    weather.getAllWeather(function(err, JSONObj){\r\n                        variables.weather = JSONObj;\r\n                    });\r\n</code>\r\n\r\nAnd the error i receive is:\r\n<code>\r\nundefined:1\r\nfailed to connect\r\n  ^\r\nSyntaxError: Unexpected token i\r\n    at Object.parse (native)\r\n    at IncomingMessage.<anonymous> (E:\\Temp\\Node.js\\Nodejs - 150421-1541\\node_mo\r\ndules\\openweather-apis\\index.js:163:38)\r\n    at IncomingMessage.emit (events.js:107:17)\r\n    at IncomingMessage.Readable.read (_stream_readable.js:373:10)\r\n    at flow (_stream_readable.js:750:26)\r\n    at resume_ (_stream_readable.js:730:3)\r\n    at _stream_readable.js:717:7\r\n    at process._tickCallback (node.js:355:11)\r\n</code>\r\n\r\nThe problem is that it's halting the code completly. I've tried checking for (err) but it halts before that since it's in the index.js of Openweather-apis that the error occurs. Any idea on how i can avoid this?\r\n\r\nPerhaps a implementation of checking if there is a valid JSON object being returned before calling the callback on your index.js:163?"}}