mirror of
https://github.com/openseadragon/openseadragon.git
synced 2024-11-25 14:46:10 +03:00
Merge pull request #679 from fs-webdev/master
Added error message tracking into the tile loading mechanism. This ex…
This commit is contained in:
commit
b56c99d367
@ -51,6 +51,7 @@ function ImageJob ( options ) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
ImageJob.prototype = {
|
ImageJob.prototype = {
|
||||||
|
errorMsg: null,
|
||||||
start: function(){
|
start: function(){
|
||||||
var _this = this;
|
var _this = this;
|
||||||
|
|
||||||
@ -64,10 +65,12 @@ ImageJob.prototype = {
|
|||||||
_this.finish( true );
|
_this.finish( true );
|
||||||
};
|
};
|
||||||
this.image.onabort = this.image.onerror = function(){
|
this.image.onabort = this.image.onerror = function(){
|
||||||
|
_this.errorMsg = "Image load aborted";
|
||||||
_this.finish( false );
|
_this.finish( false );
|
||||||
};
|
};
|
||||||
|
|
||||||
this.jobId = window.setTimeout( function(){
|
this.jobId = window.setTimeout( function(){
|
||||||
|
_this.errorMsg = "Image load exceeded timeout";
|
||||||
_this.finish( false );
|
_this.finish( false );
|
||||||
}, this.timeout);
|
}, this.timeout);
|
||||||
|
|
||||||
@ -173,7 +176,7 @@ function completeJob( loader, job, callback ) {
|
|||||||
loader.jobsInProgress++;
|
loader.jobsInProgress++;
|
||||||
}
|
}
|
||||||
|
|
||||||
callback( job.image );
|
callback( job.image, job.errorMsg );
|
||||||
}
|
}
|
||||||
|
|
||||||
}( OpenSeadragon ));
|
}( OpenSeadragon ));
|
||||||
|
@ -1011,8 +1011,8 @@ function loadTile( tiledImage, tile, time ) {
|
|||||||
tiledImage._imageLoader.addJob({
|
tiledImage._imageLoader.addJob({
|
||||||
src: tile.url,
|
src: tile.url,
|
||||||
crossOriginPolicy: tiledImage.crossOriginPolicy,
|
crossOriginPolicy: tiledImage.crossOriginPolicy,
|
||||||
callback: function( image ){
|
callback: function( image, errorMsg ){
|
||||||
onTileLoad( tiledImage, tile, time, image );
|
onTileLoad( tiledImage, tile, time, image, errorMsg );
|
||||||
},
|
},
|
||||||
abort: function() {
|
abort: function() {
|
||||||
tile.loading = false;
|
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 ) {
|
if ( !image ) {
|
||||||
$.console.log( "Tile %s failed to load: %s", tile, tile.url );
|
$.console.log( "Tile %s failed to load: %s - error: %s", tile, tile.url, errorMsg );
|
||||||
if( !tiledImage.debugMode ){
|
if( !tiledImage.debugMode ){
|
||||||
tile.loading = false;
|
tile.loading = false;
|
||||||
tile.exists = false;
|
tile.exists = false;
|
||||||
|
Loading…
Reference in New Issue
Block a user