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

feat(http): xhr error listener invokes onError #2667

Closed
wants to merge 1 commit into from

Conversation

PatrickJS
Copy link
Member

    this._xhr.addEventListener('error', (err) => {
      var responseOptions = new ResponseOptions({body: err, type: ResponseTypes.Error});
      if (isPresent(baseResponseOptions)) {
        responseOptions = baseResponseOptions.merge(responseOptions);
      }
      ObservableWrapper.callThrow(this.response, new Response(responseOptions))
    });

Review on Reviewable

@tbosch
Copy link
Contributor

tbosch commented Jun 29, 2015

This looks good, but we need a test...

@tbosch tbosch added the action: cleanup The PR is in need of cleanup, either due to needing a rebase or in response to comments from reviews label Jun 29, 2015
@PatrickJS PatrickJS force-pushed the patch-8 branch 2 times, most recently from ba6793c to 5446c6f Compare July 4, 2015 17:15
@PatrickJS
Copy link
Member Author

alright I rebased, refactored, and added a test.

@PatrickJS PatrickJS closed this Jul 5, 2015
@PatrickJS PatrickJS deleted the patch-8 branch July 5, 2015 11:50
@PatrickJS PatrickJS restored the patch-8 branch July 6, 2015 20:31
@PatrickJS PatrickJS reopened this Jul 6, 2015
@PatrickJS
Copy link
Member Author

oops I was cleaning up old branches and accidently deleted this

@tbosch tbosch added action: review The PR is still awaiting reviews from at least one requested reviewer and removed action: cleanup The PR is in need of cleanup, either due to needing a rebase or in response to comments from reviews labels Jul 7, 2015
@@ -95,6 +95,15 @@ export function main() {
expect(abortSpy).toHaveBeenCalled();
});

it('should create an error Response on error', inject([AsyncTestCompleter], async => {
var connection = new XHRConnection(sampleRequest, new MockBrowserXHR(),
Copy link
Contributor

Choose a reason for hiding this comment

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

By setting the type to ResponseTypes.Error on this ResponseOptions object, you're setting the default type to be Error, which is bad for the test, since we want to test that XHRBackend is smart enough to set the type as error based on the xhr erroring or getting a status that is considered an error.

@tbosch
Copy link
Contributor

tbosch commented Aug 18, 2015

@jeffbcross ping...

@jeffbcross
Copy link
Contributor

@gdi2290 finally scheduled this to be merged, thanks! https://github.com/angular/angular/tree/presubmit-jeffbcross-pr-2667

@PatrickJS PatrickJS deleted the patch-8 branch August 19, 2015 01:53
@PatrickJS
Copy link
Member Author

thanks!

@angular-automatic-lock-bot
Copy link

This issue has been automatically locked due to inactivity.
Please file a new issue if you are encountering a similar or related problem.

Read more about our automatic conversation locking policy.

This action has been performed automatically by a bot.

@angular-automatic-lock-bot angular-automatic-lock-bot bot locked and limited conversation to collaborators Sep 7, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
action: review The PR is still awaiting reviews from at least one requested reviewer cla: yes
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants