fix(ui): display error in ui while loading seg (#4433)

This commit is contained in:
Pedro H. Köhler authored and GitHub committed 2024-10-29 19:14:34 -04:00
1 parent 543c31109b
commit 2e96371b06
2 files changed
+23 -7

No files matched your search

@@ -122,12 +122,17 @@ function _load(
// and also return the same promise to any other callers.
loadPromises[SOPInstanceUID] = new Promise(async (resolve, reject) => {
if (!segDisplaySet.segments || Object.keys(segDisplaySet.segments).length === 0) {
await _loadSegments({
extensionManager,
servicesManager,
segDisplaySet,
headers,
});
try {
await _loadSegments({
extensionManager,
servicesManager,
segDisplaySet,
headers,
});
} catch (e) {
segDisplaySet.loading = false;
return reject(e);
}
}
const suppressEvents = true;
@@ -242,7 +242,18 @@ class CornerstoneCacheService {
if (displaySet.load && displaySet.load instanceof Function) {
const { userAuthenticationService } = this.servicesManager.services;
const headers = userAuthenticationService.getAuthorizationHeader();
await displaySet.load({ headers });
try {
await displaySet.load({ headers });
} catch (e) {
const { uiNotificationService } = this.servicesManager.services;
uiNotificationService.show({
title: 'Error loading displaySet',
message: e.message,
type: 'error',
});
console.error(e);
}
// Parametric maps have a `load` method but it should not be loaded in the
// same way as SEG and RTSTRUCT but like a normal volume