I should have checked the Frequently Asked Questions
// By default, the iFrame Transport handles all responses as success,
// so we override the iFrame to JSON converter to handle error responses:
$.ajaxSetup({
converters: {
'iframe json': function (iframe) {
var result = iframe && $.parseJSON($(iframe[0].body).text());
if (result.error) {
// Handling JSON responses with error property:
// {"error": "Upload failed"}
throw result.error;
}
return result;
}
}
});