You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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:
When jQuery calls the error callback, is passes three arguments -
error(jqXHR, textStatus, errorThrown)
.wrapError
only uses the first argument (treating it asresp
, which is somewhat wrong as its not the response, its an jQuery XMLHttpRequest-compatible object), makingtextStatus
anderrorThrown
inaccessible.Zepto passes two arguments -
xhr
andstatus
, 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.The text was updated successfully, but these errors were encountered: