Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

don't rethrow reference and syntax errors #20

Merged
merged 2 commits into from
Sep 26, 2013
Merged

don't rethrow reference and syntax errors #20

merged 2 commits into from
Sep 26, 2013

Conversation

tkazec
Copy link
Member

@tkazec tkazec commented Sep 25, 2013

Nice for catching human errors, but ends up not catching stuff like JSON.parse() errors. Better to trust the human to code well...or use a linter :)

(Worst case, human errors will either get rethrown or always trigger the error handler anyway.)


ff(function () {
JSON.parse("oops");
}).onComplete(f.slot());
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Change these to wait:

}).onComplete(f.wait());

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why? They do the same thing in this case.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's more semantically correct. You are not doing anything with the parameters of the callback, so slot is inappropriate. See my comment below for how to use slot to make sure we are getting all the expected errors.

@mikehenrty
Copy link
Contributor

I like this change Teddy, fix the test and we should be good to go.

If you really want to be a rock star, attach onError handlers instead to each sub-test and then slotPlain the error to the final completion handler. Then assert to make sure you get the error types you expect (ie string, error, reference error, syntax error).

@tkazec
Copy link
Member Author

tkazec commented Sep 26, 2013

coolio, done!

mikehenrty added a commit that referenced this pull request Sep 26, 2013
don't rethrow reference and syntax errors
@mikehenrty mikehenrty merged commit 06f0009 into play-co:master Sep 26, 2013
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants