Don't crash process if json parse is bad

This commit is contained in:
mmcwilliams 2023-12-14 14:22:55 -05:00
parent 7c3d017c90
commit 5a755114c6
3 changed files with 1 additions and 5 deletions

2
dist/client.js vendored
View File

@ -52,8 +52,6 @@ class Client {
catch (err) {
log.error('ERROR parsing JSON');
log.error(err);
process.exit(2);
return;
}
if (json === null || json.length === 0) {
log.info('No jobs found.');

2
dist/client.js.map vendored
View File

@ -1 +1 @@
{"version":3,"file":"client.js","sourceRoot":"","sources":["../src/client.ts"],"names":[],"mappings":";;;;;AAAA,4DAGmB;AACnB,+BAAkC;AAElC,oDAA4B;AAE5B,iDAAsC;AAGtC,gBAAM,CAAC,MAAM,EAAE,CAAC;AAEhB,MAAM,GAAG,GAAY,IAAA,eAAS,EAAC,QAAQ,CAAC,CAAC;AAEzC,MAAM,MAAM;IAKX;QAJQ,YAAO,GAAY,CAAC,CAAC;QACrB,QAAG,GAAY,uBAAuB,CAAC;QACvC,SAAI,GAAc,EAAE,CAAC;QAG5B,IAAI,OAAO,OAAO,CAAC,GAAG,CAAC,YAAY,KAAK,WAAW,EAAE;YACpD,IAAI,CAAC,GAAG,GAAG,OAAO,CAAC,GAAG,CAAC,YAAY,CAAC;SACpC;QACD,IAAI,CAAC,IAAI,EAAE,CAAC;IACb,CAAC;IAEM,IAAI;QACV,IAAI,CAAC,GAAG,EAAE,CAAC;QACX,WAAW,CAAC,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,EAAE,GAAG,IAAI,CAAC,CAAC;IAC7C,CAAC;IAEO,GAAG;QACV,IAAI,IAAI,CAAC,IAAI,CAAC,MAAM,IAAI,IAAI,CAAC,OAAO,EAAE;YACrC,OAAO;SACP;QACD,IAAI,CAAC,IAAI,EAAE,CAAC;IACb,CAAC;IAEO,KAAK,CAAC,IAAI;QACjB,MAAM,OAAO,GAAS;YACrB,MAAM,EAAG,KAAK;SACd,CAAC;QACF,MAAM,GAAG,GAAY,GAAG,IAAI,CAAC,GAAG,MA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CAAC;YACf,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;YAChB,OAAO;SACP;QAED,IAAI;YACH,IAAI,GAAG,MAAM,GAAG,CAAC,IAAI,EAAE,CAAC;YACxB,GAAG,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;SACf;QAAC,OAAO,GAAG,EAAE;YACb,GAAG,CAAC,KAAK,CAAC,oBAAoB,CAAC,CAAC;YAChC,GAAG,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;YACf,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;YAChB,OAAO;SACP;QAED,GAAG,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IAChB,CAAC;IAEO,SAAS,CAAE,EAAW;QAC7B,MAAM,KAAK,GAAY,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,EAAE,CAAC,CAAC;QAC7C,IAAI,KAAK,KAAK,CAAC,CAAC,EAAE;YACjB,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,KAAK,EAAE,CAAC,CAAC,CAAC;SAC3B;IACF,CAAC;CACD;AAED,IAAI,MAAM,EAAE,CAAA"}

View File

@ -60,8 +60,6 @@ class Client {
} catch (err) {
log.error('ERROR parsing JSON');
log.error(err);
process.exit(2);
return;
}
if (json === null || json.length === 0) {