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 reject m.request Promise if extract callback supplied #2006

Merged
merged 5 commits into from
Nov 13, 2017

Conversation

spacejack
Copy link
Contributor

Changes to accommodate #2000.

Description

m.request will no longer reject the Promise if the caller supplies an extract callback.

Motivation and Context

See #2000

How Has This Been Tested?

Test added.

Types of changes

  • Breaking change (fix or feature that would cause existing functionality to change)

Checklist:

  • My code follows the code style of this project.
  • My change requires a change to the documentation.
  • I have updated the documentation accordingly.
  • I have read the CONTRIBUTING document.
  • I have added tests to cover my changes.
  • All new and existing tests passed.
  • I have updated docs/change-log.md

@spacejack spacejack changed the title Extract nothrow Don't reject m.request Promise if extract callback supplied Oct 28, 2017
@spacejack
Copy link
Contributor Author

Docs should be updated, but just waiting to see what the response is to this change first.

Copy link
Contributor

@tivac tivac left a 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

@spacejack
Copy link
Contributor Author

Updated the docs, plus a minor edit to the "Retrieving response details" section that I think is a little more accurate.

Copy link
Member

@dead-claudia dead-claudia left a 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.

@@ -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) {
Copy link
Member

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)?

@spacejack
Copy link
Contributor Author

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.

@dead-claudia
Copy link
Member

@spacejack Errors thrown from extract itself should logically become rejections. Anything else is horribly unhelpful at best.

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.

3 participants