Permalink
Browse files

error handling for $.ajax()

  • Loading branch information...
1 parent e9c0dcb commit e68e9755da2960f88868f24844039c81ee6382d1 @rlidwka rlidwka committed Apr 10, 2012
Showing with 5 additions and 0 deletions.
  1. +5 −0 src/jquery.amd.js
View
@@ -32,6 +32,7 @@
basePath: "",
filename: function(str){ return str.toLowerCase(); },
suffix: ".min.js"
+ onerror: function(err){ throw err; }
};
$.define = function( moduleName, moduleDependencies, moduleDefinition ) {
@@ -202,6 +203,10 @@
dataType: "script",
cache: true,
complete: defineModule
+ error: function(jqXHR, textStatus, errorThrown) {
+ if (!errorThrown) errorThrown = new Error('Error loading "' + moduleName +'": ' + textStatus);
+ options.onerror(errorThrown);
+ }
});
}
}

0 comments on commit e68e975

Please sign in to comment.