cache-dir icon indicating copy to clipboard operation
cache-dir copied to clipboard

JSON.parse can throw (duh)

Open dfellis opened this issue 11 years ago • 2 comments

SyntaxError: Unexpected end of input at Object.parse (native) at CacheDir. (/home/uber/rt-tia/node_modules/cache-dir/index.js:17:37) at Array.forEach (native) at new CacheDir (/home/uber/rt-tia/node_modules/cache-dir/index.js:16:39) at Object. (/home/uber/rt-tia/bin/tia_server.js:33:18) at Module._compile (module.js:449:26) at Object.Module._extensions..js (module.js:467:10) at Module.load (module.js:356:32) at Function.Module._load (module.js:312:12) at Module.runMain (module.js:492:10) at process.startup.processNextTick.process._tickCallback (node.js:244:9)

dfellis avatar Mar 31 '14 18:03 dfellis

https://github.com/Raynos/safe-json-parse

Raynos avatar Mar 31 '14 19:03 Raynos

In this case, I probably want to delete the bad file from disk, so will simply try-catch and unlink the file in that situation.

dfellis avatar Mar 31 '14 20:03 dfellis