In scripts/uninstall.js lines 38-40:
} catch (e) {
if (e.code !== 'ENOENT') throw e;
}
If settings.json contains malformed JSON, JSON.parse throws a SyntaxError. SyntaxError has no .code property, so e.code !== 'ENOENT' is true and the error is re-thrown — crashing the script mid-cleanup.
At that point, .ponytail-active and config.json have already been deleted by removeIfExists() calls on lines 21-22, but settings.json may have been partially modified (if the crash happened after the delete settings.statusLine write on line 35 but before the script crashed).
Fix: catch SyntaxError specifically, or check e.code === undefined && !(e instanceof SyntaxError — actually the cleanest fix is to wrap the JSON.parse in its own try/catch.
In
scripts/uninstall.jslines 38-40:If
settings.jsoncontains malformed JSON,JSON.parsethrows aSyntaxError.SyntaxErrorhas no.codeproperty, soe.code !== 'ENOENT'istrueand the error is re-thrown — crashing the script mid-cleanup.At that point,
.ponytail-activeandconfig.jsonhave already been deleted byremoveIfExists()calls on lines 21-22, butsettings.jsonmay have been partially modified (if the crash happened after thedelete settings.statusLinewrite on line 35 but before the script crashed).Fix: catch
SyntaxErrorspecifically, or checke.code === undefined && !(e instanceof SyntaxError— actually the cleanest fix is to wrap the JSON.parse in its own try/catch.