Prior to version 1.1 this error message was more confusing - "Could not get response from server".
I contacted Michael about this behaviour in his script and suggested that he include an XHR object in the case of a failure so that client side code can try and extract a more friendly error message from the server (assuming one is returned). He agreed to make this change and I've been using it for well over a week and am very happy!
This example assumes that a JSON response is returned from the server side and that the HTTP response code is non-200 i.e. 500. This is the type of response that frameworks like Backbone.js tend to expect (which I've also been using quite heavily).
In my case, the response from the server can be boiled down to something like this (I actually return more data but that's not relevant for this example)...
The important point here is that there is a JSON object that has a property called "error".
The simpleUpload.js error handler can now do something like this...
That's a very simplistic and unnecessarily verbose example, but it shows the point. The error object in the error() callback now contains an XHR object. From that, it is possible to extract the JSON object and finally to access the "error" property. Simple!
Of course this being an example it's not production ready and just as Michael suggests in his documentation - "You should, in general, check for this property's existence before using it."
That just about covers it. There is one other nice change in the 1.1 release - the beforeSend() callback which gives you the ability to modify headers for the XHR object before a request is made to the server. Thanks to Michale for these changes and being so responsive to feedback!