From 8b71876c37d99953475d64cf12c972c4d8d7182a Mon Sep 17 00:00:00 2001 From: Grant Echols Date: Mon, 6 Jul 2015 14:56:41 -0600 Subject: [PATCH 1/3] Added error message tracking into the tile loading mechanism. This exposes the reason for the error in the console.log message --- src/imageloader.js | 5 ++++- src/tiledimage.js | 8 ++++---- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/src/imageloader.js b/src/imageloader.js index a61c8936..ef3a4f4f 100644 --- a/src/imageloader.js +++ b/src/imageloader.js @@ -51,6 +51,7 @@ function ImageJob ( options ) { } ImageJob.prototype = { + errorMsg: null, start: function(){ var _this = this; @@ -64,10 +65,12 @@ ImageJob.prototype = { _this.finish( true ); }; this.image.onabort = this.image.onerror = function(){ + _this.errorMsg = "Image load aborted"; _this.finish( false ); }; this.jobId = window.setTimeout( function(){ + _this.errorMsg = "Image load exceeded timeout"; _this.finish( false ); }, this.timeout); @@ -173,7 +176,7 @@ function completeJob( loader, job, callback ) { loader.jobsInProgress++; } - callback( job.image ); + callback( job.image, job.errorMsg ); } }( OpenSeadragon )); diff --git a/src/tiledimage.js b/src/tiledimage.js index 363df7c6..f4f9ee3f 100644 --- a/src/tiledimage.js +++ b/src/tiledimage.js @@ -1011,8 +1011,8 @@ function loadTile( tiledImage, tile, time ) { tiledImage._imageLoader.addJob({ src: tile.url, crossOriginPolicy: tiledImage.crossOriginPolicy, - callback: function( image ){ - onTileLoad( tiledImage, tile, time, image ); + callback: function( image, errorMsg ){ + onTileLoad( tiledImage, tile, time, image, errorMsg ); }, abort: function() { tile.loading = false; @@ -1020,9 +1020,9 @@ function loadTile( tiledImage, tile, time ) { }); } -function onTileLoad( tiledImage, tile, time, image ) { +function onTileLoad( tiledImage, tile, time, image, errorMsg ) { if ( !image ) { - $.console.log( "Tile %s failed to load: %s", tile, tile.url ); + $.console.log( "Tile %s failed to load: %s", tile.url, errorMsg ); if( !tiledImage.debugMode ){ tile.loading = false; tile.exists = false; From 9629f47c2c1adbcf7d59d5872e2d8a32b9578b2d Mon Sep 17 00:00:00 2001 From: Grant Echols Date: Mon, 6 Jul 2015 15:06:00 -0600 Subject: [PATCH 2/3] Added error message tracking into the tile loading mechanism. This exposes the reason for the error in the console.log message --- src/tiledimage.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/tiledimage.js b/src/tiledimage.js index f4f9ee3f..43285d4d 100644 --- a/src/tiledimage.js +++ b/src/tiledimage.js @@ -1022,7 +1022,7 @@ function loadTile( tiledImage, tile, time ) { function onTileLoad( tiledImage, tile, time, image, errorMsg ) { if ( !image ) { - $.console.log( "Tile %s failed to load: %s", tile.url, errorMsg ); + $.console.log( "Tile %s failed to load: %s - error:", tile, tile.url, errorMsg ); if( !tiledImage.debugMode ){ tile.loading = false; tile.exists = false; From 553948781486bed2e2a6cef046e56be78f4855fc Mon Sep 17 00:00:00 2001 From: Grant Echols Date: Mon, 6 Jul 2015 15:07:00 -0600 Subject: [PATCH 3/3] Added error message tracking into the tile loading mechanism. This exposes the reason for the error in the console.log message --- src/tiledimage.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/tiledimage.js b/src/tiledimage.js index 43285d4d..960d91d9 100644 --- a/src/tiledimage.js +++ b/src/tiledimage.js @@ -1022,7 +1022,7 @@ function loadTile( tiledImage, tile, time ) { function onTileLoad( tiledImage, tile, time, image, errorMsg ) { if ( !image ) { - $.console.log( "Tile %s failed to load: %s - error:", tile, tile.url, errorMsg ); + $.console.log( "Tile %s failed to load: %s - error: %s", tile, tile.url, errorMsg ); if( !tiledImage.debugMode ){ tile.loading = false; tile.exists = false;