errors in .ajax are not propagated to .catch
Open
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 31.7k
- Forks
- 3k
- PR merge metrics
- No merged PRs in 30d
Description
hello,
it seems that errors may not be being properly handled in the ajax operator.
RxJS version:
5.3.0
Code to reproduce:
// index.js (run in node, after installing rxjs, nock, & xmlhttprequest)
var nock = require('nock')
var Observable = require('rxjs').Observable
global.window = global
global.XMLHttpRequest = require('xmlhttprequest').XMLHttpRequest
nock('http://example.com').get('/test/1').reply(200, '!!INVALID-JSON!!') // :eyes:
var obs = Observable
.from([1])
.switchMap(action => {
return Observable
.from([2])
.ajax({ url: 'http://example.com/test/1', method: 'GET' }) // does not work per expectation
// .map(({ response }) => { throw new Error('bananas') }) // works per expectation
.catch(err => {
console.error(err.message) // never reached when JSON wasn't parseable from ajax request
process.exit()
})
})
obs.subscribe(arg => console.log('bananas'))
Expected behavior:
.catch entered
Actual behavior:
.catch not entered
Additional information:
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by running the index.js reproduction against RxJS 5.3.0 and trace the ajax operator's handling of the invalid JSON response. The work is done when the malformed response reaches .catch as an error, matching the expected behavior described in the issue.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript, node.js, typescript
- Domain
- networking
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100