diff --git a/lib/eupmc.js b/lib/eupmc.js index 3ec79f9..7e7a883 100644 --- a/lib/eupmc.js +++ b/lib/eupmc.js @@ -62,8 +62,8 @@ EuPmc.prototype.completeCallback = function(data) { var resp = data.responseWrapper; - if(!resp.hitCount[0] || !resp.resultList[0].result) { - log.error("Malformed response from EuropePMC. Try running again."); + if(!resp.hitCount || !resp.hitCount[0] || !resp.resultList[0].result) { + log.error("Malformed or empty response from EuropePMC. Try running again. Perhaps your query is wrong."); process.exit(1); }