From 1c6a57c7100081318a54f8ed6a5d359cd7a0365f Mon Sep 17 00:00:00 2001 From: Chris Adams Date: Wed, 26 Jun 2013 17:17:50 -0400 Subject: [PATCH] makeAjaxRequest: log all errors, test callback * All AJAX errors will log to the console * The onError callback will only be called if defined --- src/openseadragon.js | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/openseadragon.js b/src/openseadragon.js index 5acc4468..2a6e2689 100644 --- a/src/openseadragon.js +++ b/src/openseadragon.js @@ -1321,7 +1321,11 @@ window.OpenSeadragon = window.OpenSeadragon || function( options ){ if ( request.status == 200 ) { onSuccess( request ); } else { - onError( request ); + $.console.log("AJAX request returned %s: %s", request.status, url); + + if ($.isFunction(onError)) { + onError( request ); + } } } }; @@ -1335,7 +1339,9 @@ window.OpenSeadragon = window.OpenSeadragon || function( options ){ request.onreadystatechange = function(){}; request = null; - onError( request, e ); + if ($.isFunction(onError)) { + onError( request, e ); + } } },