Fallback to raw output when JSON.parse fails

Partial fix for #77
This commit is contained in:
WebFreak001 2016-12-06 23:25:16 +01:00
commit 9e5d12551f
2 changed files with 19 additions and 1 deletions

View file

@ -136,7 +136,13 @@ export function parseMI(output: string): MINode {
stringEnd++;
}
// hax
let str = JSON.parse(output.substr(0, stringEnd));
let str;
try {
str = JSON.parse(output.substr(0, stringEnd));
}
catch (e) {
str = output.substr(0, stringEnd);
}
output = output.substr(stringEnd);
return str;
};