Skip to content
This repository has been archived by the owner on Aug 3, 2022. It is now read-only.

modified 2 'new Error'-occurences to 'throw new Error' (so it becomes… #17

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

coderofsalvation
Copy link

… catchable, like the other)

@flosse
Copy link
Owner

flosse commented Mar 18, 2017

@coderofsalvation the patch seems to contain an invalid token :-
Would you mind to fix that?
And adding tests would be cool ;-)

@coderofsalvation
Copy link
Author

coderofsalvation commented Mar 18, 2017

ah yes, I wasn't really awake i guess.

SyntaxError: Store.es6.js: Unexpected token (163:16)
  161 |     let e, item;
  162 |     if (err) {
> 163 |       const e = throw new Error("could not load data");
      |                 ^
  164 |       if (typeof cb === "function") {
  165 |         return cb(e);
  166 |       } else {

actually Im not really sure what the intention is with using 'new Error' instead of just 'Error' and passing that to a callback.
The reason why i started this PR is because people who use this package indirectly might get confused with these error-messages.
These error messages come from json-file-store at the first run, when the file doesn't exist yet.
Do you have suggestions to prevent json-file-store dumping uncatchable Error-messages in the console?

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants