{"action":"created","issue":{"url":"https://api.github.com/repos/Alex7Kom/node-steam-tradeoffers/issues/127","labels_url":"https://api.github.com/repos/Alex7Kom/node-steam-tradeoffers/issues/127/labels{/name}","comments_url":"https://api.github.com/repos/Alex7Kom/node-steam-tradeoffers/issues/127/comments","events_url":"https://api.github.com/repos/Alex7Kom/node-steam-tradeoffers/issues/127/events","html_url":"https://github.com/Alex7Kom/node-steam-tradeoffers/issues/127","id":90447548,"number":127,"title":"_loadInventory is returning \"Unknown response\" error when response is valid but API results in body of {success: false, error: ''}","user":{"login":"Mr-KoKa","id":12898220,"avatar_url":"https://avatars.githubusercontent.com/u/12898220?v=3","gravatar_id":"","url":"https://api.github.com/users/Mr-KoKa","html_url":"https://github.com/Mr-KoKa","followers_url":"https://api.github.com/users/Mr-KoKa/followers","following_url":"https://api.github.com/users/Mr-KoKa/following{/other_user}","gists_url":"https://api.github.com/users/Mr-KoKa/gists{/gist_id}","starred_url":"https://api.github.com/users/Mr-KoKa/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Mr-KoKa/subscriptions","organizations_url":"https://api.github.com/users/Mr-KoKa/orgs","repos_url":"https://api.github.com/users/Mr-KoKa/repos","events_url":"https://api.github.com/users/Mr-KoKa/events{/privacy}","received_events_url":"https://api.github.com/users/Mr-KoKa/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/Alex7Kom/node-steam-tradeoffers/labels/enhancement","name":"enhancement","color":"84b6eb"}],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":2,"created_at":"2015-06-23T17:41:41Z","updated_at":"2015-07-22T17:11:53Z","closed_at":"2015-07-16T18:44:17Z","body":"So, _loadInventory method is checking:\r\n```javascript\r\nif (!body || !body.rgInventory || !body.rgDescriptions || !body.rgCurrency)\r\n```\r\nand if any of those are fullfilled it is returning\r\n```javascript\r\nreturn callback(new Error('Invalid Response'));\r\n```\r\nBut there are (random) cases when Steam API results in {success: false, error: ''} and I would interpret it differently by inserting below code, before return line mentioned.\r\n```javascript\r\nif(body && !body.success){\r\n\tthis.emit('debug', 'loading inventory: unknown steam api error');\r\n\treturn callback(new Error('Unknown Steam API error'));\r\n}\r\n```\r\nOr even before checking if body is false.\r\n\r\nIt's my first issue on github so, please excuse me if I didn't format text correctly.\r\n\r\n**Edit**: I just had another idea, that you can actually check if there is any error in body response and print it out like:\r\n```javascript\r\nif(body && !body.success){\r\n\tif(body.error && body.error.length > 0){\r\n\t\tthis.emit('debug', 'loading inventory: steam api error: ' + body.error);\r\n\t\treturn callback(new Error('Steam API error: ' + body.error));\r\n\t} else {\r\n\t\tthis.emit('debug', 'loading inventory: unknown steam api error');\r\n\t\treturn callback(new Error('Unknown Steam API error'));\r\n\t}\r\n}\r\n```"},"comment":{"url":"https://api.github.com/repos/Alex7Kom/node-steam-tradeoffers/issues/comments/123795110","html_url":"https://github.com/Alex7Kom/node-steam-tradeoffers/issues/127#issuecomment-123795110","issue_url":"https://api.github.com/repos/Alex7Kom/node-steam-tradeoffers/issues/127","id":123795110,"user":{"login":"Mr-KoKa","id":12898220,"avatar_url":"https://avatars.githubusercontent.com/u/12898220?v=3","gravatar_id":"","url":"https://api.github.com/users/Mr-KoKa","html_url":"https://github.com/Mr-KoKa","followers_url":"https://api.github.com/users/Mr-KoKa/followers","following_url":"https://api.github.com/users/Mr-KoKa/following{/other_user}","gists_url":"https://api.github.com/users/Mr-KoKa/gists{/gist_id}","starred_url":"https://api.github.com/users/Mr-KoKa/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Mr-KoKa/subscriptions","organizations_url":"https://api.github.com/users/Mr-KoKa/orgs","repos_url":"https://api.github.com/users/Mr-KoKa/repos","events_url":"https://api.github.com/users/Mr-KoKa/events{/privacy}","received_events_url":"https://api.github.com/users/Mr-KoKa/received_events","type":"User","site_admin":false},"created_at":"2015-07-22T17:11:53Z","updated_at":"2015-07-22T17:11:53Z","body":"@Alex7Kom, you should also check if body.error isn't null as I did in example, because sometimes there is no error, and emiting that will probably throw."}}