-
Notifications
You must be signed in to change notification settings - Fork 3k
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
Observable.ajax error 0 #1926
Comments
I think
Basically it's set to zero to start with, and doesn't change until it gets an HTTP status code back from the response. |
It's not unreasonable to argue that my reading of the error message was naive, expecting an HTTP error code and getting a 0 instead (and being confused by it). @jayphelps you've made a reasonable case for sticking with 0. |
I notice that the original error object is also discarded. Is there any way we could improve the ajax error handling to give more context into these errors? I'd be happy to PR something but not sure what best approach would be. The only thing that came to mind is passing the original XHR error through. |
Agreed. In the case of a network error, the observable will emit an error from A 0 status code doesn't just imply a network error but many other things: https://stackoverflow.com/a/26451773/5932012 Therefore I don't see any reliable way to infer whether an error was caused by a network error or something else. |
There appears to be bigger issues with the latest ajax functionality, but nothing is truly being addressed. IN fact the docs for the latest api show an example that fails , yet no one has addressed the issue, despite many issue reports. I love rxjs observable but the lack of consistency is creating a situation where our project will soon be dropping it. One issue I have (which is pretty glaring considering the behaviours of similar libraries) is the apparent inability to handle simple get requests with parameters. If there is such an ability, the documentation, examples and offered solutions somehow manage to completely be absent of this base functionality. For exampe, the following using rxjs with react-redux (redux-observable) implements Observable ajax, exampes are tried with ajax() and ajax.get()
All also work using jQuery, request and axios to make the same requests. So am I missing something glaringly obvious, or is there a real issue which no one wants to look into here?? In each case, the back end isnt' even touched (in this case a simple express server) but with the other libraries everything works as it should. |
I don’t enjoy people threatening to stop using things I make. It’s free software that I do in my personal time and don’t get a single cent for. Being abusive just makes me to want to help even less. |
I am sorry you thought it a threat, it was certainly never intended as such. It was simply an observation and personal opinion. Of course there is a degree of frustration, and the library is generally appreciated. However it is not anything personal, I do not partake in such things. |
@jayphelps, please do not take such criticism as abuse, I can't really see how it could have been construed as such, but I apologise if that's how you took it. |
I also fully admit it could well be my misunderstanding of the API / docs, I'd if so, I gladly hold my hands up as the guilty party |
clarification: I thought this conversation was on redux-observable’s issue tracker as you commented there as well and I mixed them up redux-observable/redux-observable#84 (comment). So my statements here aren’t entirely applicable as rxjs is much more of a community project and I left the core team a while ago (time constraints). They do not necessarily reflect the opinions of the core team and I’m sorry for confusing the two. My thoughts still apply to your comments in redux-observable. As a fellow community member I still think such repeated comments are abusive and counterproductive. I can’t express how demotivating it is.
|
I'm also getting this error and now wondering whether URL parameters are supported in rxjs' |
@aranda-adapptor AFAIK you have to append them yourself to the URL. |
@aranda-adapptor yup, as mentioned above you need to construct the query string yourself. This is pretty trivial though since there are a number of libraries to do this, including the built in |
@OliverJAsh @iansinnott I am indeed appending them (just using string interpolation) and still getting this error. Reading the comments above implied that it may not be supported. Thanks for clarifying that it is supported. I guess my issue lies elsewhere! |
@aranda-adapptor Try Chrome Dev Tools. It should say in the console why the XMLHttpRequest was refused. 👍 Just keep in mind that status code zero can mean many things nearly all of which cannot be known programmatically. Only in the dev tools |
This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs. |
RxJS version:
5.0.0-beta.11
Code to reproduce:
Expected behavior:
Output: Err: ajax network error
Actual behavior:
Output: Err: ajax error 0
Additional information:
At the moment if you encounter a network error, the xhr spec requires a response with status 0.
I'd argue that the error message is opaque, and we should look use the text 'network error' in place of just 'status 0' in the
AjaxError
.Thoughts?
The text was updated successfully, but these errors were encountered: