{"action":"created","issue":{"url":"https://api.github.com/repos/fictorial/linode-api/issues/6","labels_url":"https://api.github.com/repos/fictorial/linode-api/issues/6/labels{/name}","comments_url":"https://api.github.com/repos/fictorial/linode-api/issues/6/comments","events_url":"https://api.github.com/repos/fictorial/linode-api/issues/6/events","html_url":"https://github.com/fictorial/linode-api/pull/6","id":124000323,"number":6,"title":"Don't crash when Linode returns an invalid JSON","user":{"login":"Matheus28","id":614967,"avatar_url":"https://avatars.githubusercontent.com/u/614967?v=3","gravatar_id":"","url":"https://api.github.com/users/Matheus28","html_url":"https://github.com/Matheus28","followers_url":"https://api.github.com/users/Matheus28/followers","following_url":"https://api.github.com/users/Matheus28/following{/other_user}","gists_url":"https://api.github.com/users/Matheus28/gists{/gist_id}","starred_url":"https://api.github.com/users/Matheus28/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Matheus28/subscriptions","organizations_url":"https://api.github.com/users/Matheus28/orgs","repos_url":"https://api.github.com/users/Matheus28/repos","events_url":"https://api.github.com/users/Matheus28/events{/privacy}","received_events_url":"https://api.github.com/users/Matheus28/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":1,"created_at":"2015-12-27T23:10:00Z","updated_at":"2016-01-01T20:09:44Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/fictorial/linode-api/pulls/6","html_url":"https://github.com/fictorial/linode-api/pull/6","diff_url":"https://github.com/fictorial/linode-api/pull/6.diff","patch_url":"https://github.com/fictorial/linode-api/pull/6.patch"},"body":"Sometimes, because of 5xx errors, Linode doesn't actually return a JSON, but an error string. That causes linode-api to crash. This patch fixes this by forwarding an invalid JSON error to the callback.\r\n\r\nPlease notice that I don't actually write in Coffeescript, but the code should be correct (it's equivalent to the change I made locally directly to the .js file to fix this)."},"comment":{"url":"https://api.github.com/repos/fictorial/linode-api/issues/comments/168335345","html_url":"https://github.com/fictorial/linode-api/pull/6#issuecomment-168335345","issue_url":"https://api.github.com/repos/fictorial/linode-api/issues/6","id":168335345,"user":{"login":"Matheus28","id":614967,"avatar_url":"https://avatars.githubusercontent.com/u/614967?v=3","gravatar_id":"","url":"https://api.github.com/users/Matheus28","html_url":"https://github.com/Matheus28","followers_url":"https://api.github.com/users/Matheus28/followers","following_url":"https://api.github.com/users/Matheus28/following{/other_user}","gists_url":"https://api.github.com/users/Matheus28/gists{/gist_id}","starred_url":"https://api.github.com/users/Matheus28/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Matheus28/subscriptions","organizations_url":"https://api.github.com/users/Matheus28/orgs","repos_url":"https://api.github.com/users/Matheus28/repos","events_url":"https://api.github.com/users/Matheus28/events{/privacy}","received_events_url":"https://api.github.com/users/Matheus28/received_events","type":"User","site_admin":false},"created_at":"2016-01-01T20:09:44Z","updated_at":"2016-01-01T20:09:44Z","body":"Actually, what is happening isn't exactly invalid JSON. But the Linode API replies with no body, and body = undefined, so it JSON.parse stringifies it and that's where the \"invalid JSON\" comes from. The fix still stands, though."}}