techfort / LokiJS

javascript embeddable / in-memory database
http:/techfort.github.io/LokiJS
MIT License
6.73k stars 482 forks source link

loki-fs-structured adapter leaks errors when loading and parsing container file #800

Closed josh-sachs-epic closed 4 years ago

josh-sachs-epic commented 5 years ago

Noticed a few issues when vetting this adapter for a project I'm working on.

  1. the read line delegate did not attempt to catch and surface errors thrown by it's call to JSON.parse (notice the safe implementation already existed in loadNextCollection).

  2. the fstat delegate did not correctly evaluate the returned error code before assuming the error was "file not exists." Additionally, in cases where stats.isFile() returned false, it was incorrectly reporting back "file not exists" when, in fact, the issue could be that something else exists at the path (e.g. a directory)... which should be an error condition.

I've submitted a PR to address the issue here: https://github.com/techfort/LokiJS/pull/799

stale[bot] commented 4 years ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

josh-sachs-epic commented 4 years ago

Got the alert that this issue was being flagged as stale, however the approved PR with the fix doesn't look like it has been merged yet. Any updates on if this can make it in?

Thanks

stale[bot] commented 4 years ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.