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

wrapError not compatible with jQuery's passed arguments #485

Closed
shesek opened this issue Jul 19, 2011 · 1 comment
Closed

wrapError not compatible with jQuery's passed arguments #485

shesek opened this issue Jul 19, 2011 · 1 comment

Comments

@shesek
Copy link
Contributor

shesek commented Jul 19, 2011

When jQuery calls the error callback, is passes three arguments - error(jqXHR, textStatus, errorThrown). wrapError only uses the first argument (treating it as resp, which is somewhat wrong as its not the response, its an jQuery XMLHttpRequest-compatible object), making textStatus and errorThrown inaccessible.

Zepto passes two arguments - xhr and status, which is also not compatible with wrapError.

The simplest solution that won't break backward compatibility and work with both jQuery and Zepto would be to just pass everything after the first argument as additional arguments to the wrapped onError, something like:

onError.apply(null, [model, resp, options].concat(Array.prototype.slice.call(arguments, 1)))

Than one would use function(model, jqXHR, options, textStatus, errorThrown) to access everything.

@shesek shesek closed this as completed Jul 19, 2011
@shesek shesek reopened this Jul 19, 2011
@jashkenas
Copy link
Owner

I believe that we pass the complete response object now, to wrapError ... you should be able to access everything you need.

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

No branches or pull requests

2 participants