Deal with Coverage's unkown state.

Part of issue #16.
This commit is contained in:
Thaddee Tyl 2014-01-05 15:41:35 +01:00
parent c3fd3cfd79
commit a780b25233

View File

@ -102,6 +102,12 @@ function(data, match, end, ask) {
try {
var score = buffer.split('_')[1].split('.')[0];
var percentage = parseInt(score);
if (percentage !== percentage) {
// It is NaN, treat it as unknown.
badgeData.text[1] = 'unknown';
badge(badgeData, makeSend(format, ask.res, end));
return;
}
} catch(e) {
badgeData.text[1] = 'malformed';
badge(badgeData, makeSend(format, ask.res, end));