-
Notifications
You must be signed in to change notification settings - Fork 96
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
Way to know timeout errors vs other errors? #88
Comments
We have only one callback and only one error object. The point here is to mimic request/request from node, so I'll check how timeout is resolved there and that's the guideline. Could you add more context here? |
@naugtur thanks for the quick response! We have a project that provides streaming video support for video.js and a big part of that is downloading video chunks over XHR. We have timeouts specified for individual requests so that we have an opportunity to switch down to a lower quality level if the viewer's bandwidth has changed dramatically. We currently have an XHR shim that allows us to determine whether a request failed due to a server error or an expired timeout and have different handling for both cases. We'd love to get rid of our own XHR and use this project but we think separate timeout handling is an important behavior. I appreciate your suggestion to use |
In that case, I honestly don't see any difficulty in distinguishing between types of errors you can get.
This being said, we should be able to implement giving a direct hint in the error that you're dealing with a timeout. BTW. I just tested xhr in android4 basic browser recently and all tests passed. Something about the timeout feature is failing in android2. |
Hmm... we also abort XHRs from our code if the viewer seeked and we no longer need the chunk we had been downloading, for instance. I believe that is also considered an error status for the request. Would we be able to distinguish that scenario from a timeout? I guess we could decorate the request object before aborting it ourselves but that seems a little inelegant. |
Aborting the XHRs yourself will have different results depending on browsers. This discussion is getting diluted, we need actions. Thanks to that we'll be able to check different browsers too. (I sometimes have access to weird browsers, including on android2 or kindle3g) |
Sounds like a great idea. I'll give it a shot. |
It seems like a convention in node to use |
Take a look: #92 |
It looks like all errors call the same error function but we need to know specifically when it's a timeout error to inform an adaptive video algorithm. Am I missing anything, or any suggestions on how it should be added?
Thanks.
The text was updated successfully, but these errors were encountered: