Skip to content

Commit

Permalink
Merge pull request #666 from camicroscope/better-load-err
Browse files Browse the repository at this point in the history
Show tileserver errors as usual redirect
  • Loading branch information
birm authored Jan 11, 2024
2 parents ec883a9 + 25b7947 commit 0108ac2
Show file tree
Hide file tree
Showing 6 changed files with 24 additions and 0 deletions.
4 changes: 4 additions & 0 deletions apps/heatmap/init.js
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,10 @@ function initCore() {

$CAMIC.loadImg(async function(e) {
Loading.open(document.body, `Loading Data ...`);
$CAMIC.viewer.addHandler('open-failed', function(e) {
console.error(e.message, e);
redirect($D.pages.table, e.message, 5);
});
// image loaded
if (e.hasError) {
$UI.message.addError(e.message);
Expand Down
4 changes: 4 additions & 0 deletions apps/labeling/labeling.js
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,10 @@ function initCore() {
defaultText: `Slide: ${$D.params.data.name}`,
});
}
$CAMIC.viewer.addHandler('open-failed', function(e) {
console.error(e.message, e);
redirect($D.pages.table, e.message, 5);
});
});

$CAMIC.viewer.addHandler('open', function() {
Expand Down
4 changes: 4 additions & 0 deletions apps/mini/init.js
Original file line number Diff line number Diff line change
Expand Up @@ -161,6 +161,10 @@ function initCore() {
}

$CAMIC.loadImg(function(e) {
$CAMIC.viewer.addHandler('open-failed', function(e){
console.error(e.message, e)
redirect($D.pages.table, e.message, 5);
})
// image loaded
if (e.hasError) {
// if this is a retry, assume normal behavior (one retry per slide)
Expand Down
4 changes: 4 additions & 0 deletions apps/model/model.js
Original file line number Diff line number Diff line change
Expand Up @@ -404,6 +404,10 @@ function initCore() {
} else {
$D.params.data = e;
}
$CAMIC.viewer.addHandler('open-failed', function(e) {
console.error(e.message, e);
redirect($D.pages.table, e.message, 5);
});
});

$CAMIC.store.getSlide($D.params.slideId).then((response) => {
Expand Down
4 changes: 4 additions & 0 deletions apps/segment/segment.js
Original file line number Diff line number Diff line change
Expand Up @@ -371,6 +371,10 @@ function initCore() {
} else {
$D.params.data = e;
}
$CAMIC.viewer.addHandler('open-failed', function(e) {
console.error(e.message, e);
redirect($D.pages.table, e.message, 5);
});
});

$CAMIC.viewer.addOnceHandler('open', function(e) {
Expand Down
4 changes: 4 additions & 0 deletions apps/viewer/init.js
Original file line number Diff line number Diff line change
Expand Up @@ -195,6 +195,10 @@ function initCore() {
}

$CAMIC.loadImg(function(e) {
$CAMIC.viewer.addHandler('open-failed', function(e) {
console.error(e.message, e);
redirect($D.pages.table, e.message, 5);
});
// image loaded
if (e.hasError) {
// if this is a retry, assume normal behavior (one retry per slide)
Expand Down

0 comments on commit 0108ac2

Please sign in to comment.