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

Unhandled exception is thrown if AjaxObservable fails to parse response #3138

Closed
myklt opened this issue Nov 28, 2017 · 2 comments · Fixed by #3139 or severest/retrobot#221
Closed

Comments

@myklt
Copy link
Contributor

myklt commented Nov 28, 2017

RxJS version: 5.5.2

Code to reproduce:
Please find test cases in the PR which will follow up the issue.

Expected behavior:
AjaxObservable sends an error to subscribers which could be caught using catchError operator.

Actual behavior:
If responseType is '' in response, but it was set to json in request and xhr's response or responseText is not valid JSON, the unhandled error "Invalid character" is thrown.

Additional information:
The error is reproducible with IE11 only. Once the resource is not found, there is a proxy on our server, which overtakes the response and returns HTML 404 page.

myklt added a commit to myklt/rxjs that referenced this issue Nov 28, 2017
Catch error when parsing json response and notify observer with thrown error.
JSON could be invalid if proxy overtakes the response and in IE responseType is empty.

closes ReactiveX#3138
@marcusstenbeck
Copy link

Any plans to merge this in? I'm running into the same problem.

@dengwanc
Copy link

@benlesh or @kwonoj

cartant pushed a commit to myklt/rxjs that referenced this issue Jul 7, 2018
Catch error when parsing json response and notify observer with thrown error.
JSON could be invalid if proxy overtakes the response and in IE responseType is empty.

closes ReactiveX#3138
benlesh pushed a commit that referenced this issue Jul 26, 2018
#3139)

* fix(AjaxObservable): notify with error if fails to parse json response

Catch error when parsing json response and notify observer with thrown error.
JSON could be invalid if proxy overtakes the response and in IE responseType is empty.

closes #3138

* chore(lint): remove semicolon
@lock lock bot locked as resolved and limited conversation to collaborators Aug 25, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
3 participants