featherlight icon indicating copy to clipboard operation
featherlight copied to clipboard

Attempting to handle a failed AJAX load

Open zflat opened this issue 7 years ago • 1 comments

Hi, it looks like the "error" status for load should call deferred.reject() and not deferred.fail()

https://github.com/noelboss/featherlight/blob/c4ed1235ebfdcec54a7a2946c461410de60f61e2/src/featherlight.js#L398

I am using it like this:

var modal = new $.featherlight("/my-uri")
var p = modal.open()
p.fail(function() {
  console.log("fail callback")
})

If the URL provided is a 404 for example, the fail callback does not get fired because you don't reject the deferred object.

zflat avatar May 17 '18 14:05 zflat

Good catch. Would you be kind enough to provide a PR?

marcandre avatar May 18 '18 02:05 marcandre