-
-
Notifications
You must be signed in to change notification settings - Fork 923
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 reject m.request Promise if extract callback supplied #2006
Conversation
Docs should be updated, but just waiting to see what the response is to this change first. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM for mithril@2.0.0
Updated the docs, plus a minor edit to the "Retrieving response details" section that I think is a little more accurate. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I like this. I actually find it a little surprising that it didn't work that way, since that's pretty much how the docs seemed to explain it.
request/tests/test-request.js
Outdated
@@ -519,5 +519,19 @@ o.spec("xhr", function() { | |||
o(e instanceof Error).equals(true) | |||
}).then(done) | |||
}) | |||
o("does not reject on error when extract provided", function(done) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should we also add a test to ensure that a throwing extract
still errors? Or is it already tested (in which this one needs its name clarified)?
Ok, I've added an additional test for that. I don't know how to ensure that the catch actually fires (I console logged it while testing to be sure that it did.) But I don't know how to get ospec to fail if line 546 isn't reached. The other tests don't seem to deal with that either, I suppose they assume those code paths will execute. |
@spacejack Errors thrown from |
Changes to accommodate #2000.
Description
m.request
will no longer reject the Promise if the caller supplies anextract
callback.Motivation and Context
See #2000
How Has This Been Tested?
Test added.
Types of changes
Checklist:
docs/change-log.md