Promise chains break on esi errors

Issue #514 resolved
Chris Abernethy created an issue

The esi functions which include $.ajax calls are not properly handling ajax errors when inspecting the result for ESI warnings using deferred.always().

The documentation for jQuery's deferred.always() contains the following note:

Note: The deferred.always() method receives the arguments that were used to .resolve() or .reject() the Deferred object, which are often very different. For this reason, it's best to use it only for actions that do not require inspecting the arguments. In all other cases, use explicit .done() or .fail() handlers since the arguments will have well-known orders.

All $.ajax calls currently use deferred.always() to inspect the headers in the jqXHR responses for ESI route deprecation notices. This inspection fails when the arguments to deferred.always() are in reject() order, because the referenced xhr argument contains an errorThrown value from deferred.fail().

The call to xhr.getAllResponseHeaders() in this situation throws an error, and the promise chain fails without a handler. The mask search dialog then hangs in a corrupted state and ceases to be usable without a page reload.

This is one of the issues that is contributing to the inability to create new masks or to add players or corporations to existing masks (#503).

Comments (4)

  1. Log in to comment