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

`.ajax()` documentation unclear about expectations/data type for `errorThrown` #1113

Open
timmywil opened this issue Nov 1, 2018 · 1 comment

Comments

@timmywil
Copy link
Member

@timmywil timmywil commented Nov 1, 2018

Migrated from jQuery repo: jquery/jquery#4211

Description

There is a seeming contradiction in the documentation for $.ajax().

The docs for the error setting of this function indicate:

... The function receives three arguments: The jqXHR (in jQuery 1.4.x, XMLHttpRequest) object, a string describing the type of error that occurred and an optional exception object, if one occurred...

But later the same docs indicate:

... When an HTTP error occurs, errorThrown receives the textual portion of the HTTP status, such as "Not Found" or "Internal Server Error." ...

In addition, the docs indicate that the type of the parameter is String. But, based on the first sentence, it sounds like it can be either an object or a string; which is it?

Separately, it appears that the errorThrown will always be an empty string for HTTP errors that occur when using HTTP/2 (aka H2). This appears to be because statusText is always an empty string for an HTTP/2 request (more info: https://stackoverflow.com/questions/41632077/why-is-the-statustext-of-my-xhr-empty).

I'd love it for the jQuery team to weigh-in on both of these limitations in the current docs.

@timmywil
Copy link
Member Author

@timmywil timmywil commented Nov 1, 2018

I agree we should be consistent and clear about the parameter type for the third argument.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
1 participant
You can’t perform that action at this time.