feat: Add error handler to CWIL
This commit is contained in:
parent
e7b32cc51e
commit
70e4c55920
@ -1,6 +1,7 @@
|
|||||||
import cornerstone from 'cornerstone-core';
|
import cornerstone from 'cornerstone-core';
|
||||||
import cornerstoneWADOImageLoader from 'cornerstone-wado-image-loader';
|
import cornerstoneWADOImageLoader from 'cornerstone-wado-image-loader';
|
||||||
import dicomParser from 'dicom-parser';
|
import dicomParser from 'dicom-parser';
|
||||||
|
import { errorHandler } from '@ohif/core'
|
||||||
|
|
||||||
let initialized = false;
|
let initialized = false;
|
||||||
|
|
||||||
@ -35,6 +36,9 @@ export default function initWADOImageLoader(UserAuthenticationService) {
|
|||||||
xhr.setRequestHeader('Authorization', headers.Authorization);
|
xhr.setRequestHeader('Authorization', headers.Authorization);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
errorInterceptor: error => {
|
||||||
|
errorHandler.getHTTPErrorHandler(error)
|
||||||
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
initWebWorkers();
|
initWebWorkers();
|
||||||
|
|||||||
@ -7,7 +7,7 @@ import {
|
|||||||
processSeriesResults,
|
processSeriesResults,
|
||||||
} from './qido.js';
|
} from './qido.js';
|
||||||
import dcm4cheeReject from './dcm4cheeReject';
|
import dcm4cheeReject from './dcm4cheeReject';
|
||||||
import { DicomMetadataStore, IWebApiDataSource, utils } from '@ohif/core';
|
import { DicomMetadataStore, IWebApiDataSource, utils, errorHandler } from '@ohif/core';
|
||||||
|
|
||||||
import getImageId from './utils/getImageId';
|
import getImageId from './utils/getImageId';
|
||||||
import dcmjs from 'dcmjs';
|
import dcmjs from 'dcmjs';
|
||||||
@ -52,11 +52,14 @@ function createDicomWebApi(dicomWebConfig, UserAuthenticationService) {
|
|||||||
const qidoConfig = {
|
const qidoConfig = {
|
||||||
url: qidoRoot,
|
url: qidoRoot,
|
||||||
headers: UserAuthenticationService.getAuthorizationHeader(),
|
headers: UserAuthenticationService.getAuthorizationHeader(),
|
||||||
|
errorInterceptor: errorHandler.getHTTPErrorHandler(),
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
const wadoConfig = {
|
const wadoConfig = {
|
||||||
url: wadoRoot,
|
url: wadoRoot,
|
||||||
headers: UserAuthenticationService.getAuthorizationHeader(),
|
headers: UserAuthenticationService.getAuthorizationHeader(),
|
||||||
|
errorInterceptor: errorHandler.getHTTPErrorHandler(),
|
||||||
};
|
};
|
||||||
|
|
||||||
// TODO -> Two clients sucks, but its better than 1000.
|
// TODO -> Two clients sucks, but its better than 1000.
|
||||||
|
|||||||
@ -39,6 +39,14 @@ window.config = {
|
|||||||
configuration: {},
|
configuration: {},
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
|
httpErrorHandler: error => {
|
||||||
|
// This is 429 when rejected from the public idc sandbox too often.
|
||||||
|
console.warn(error.status);
|
||||||
|
|
||||||
|
// Could use services manager here to bring up a dialog/modal if needed.
|
||||||
|
console.warn('test, navigate to https://ohif.org/');
|
||||||
|
window.location = 'https://ohif.org/';
|
||||||
|
},
|
||||||
// whiteLabeling: {
|
// whiteLabeling: {
|
||||||
// /* Optional: Should return a React component to be rendered in the "Logo" section of the application's Top Navigation bar */
|
// /* Optional: Should return a React component to be rendered in the "Logo" section of the application's Top Navigation bar */
|
||||||
// createLogoComponentFn: function (React) {
|
// createLogoComponentFn: function (React) {
|
||||||
|
|||||||
@ -14,6 +14,7 @@ import {
|
|||||||
HangingProtocolService,
|
HangingProtocolService,
|
||||||
CineService,
|
CineService,
|
||||||
UserAuthenticationService,
|
UserAuthenticationService,
|
||||||
|
errorHandler
|
||||||
// utils,
|
// utils,
|
||||||
} from '@ohif/core';
|
} from '@ohif/core';
|
||||||
|
|
||||||
@ -62,6 +63,12 @@ function appInit(appConfigOrFunc, defaultExtensions) {
|
|||||||
UserAuthenticationService,
|
UserAuthenticationService,
|
||||||
]);
|
]);
|
||||||
|
|
||||||
|
errorHandler.getHTTPErrorHandler = () => {
|
||||||
|
if (typeof appConfig.httpErrorHandler === 'function') {
|
||||||
|
return appConfig.httpErrorHandler;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Example: [ext1, ext2, ext3]
|
* Example: [ext1, ext2, ext3]
|
||||||
* Example2: [[ext1, config], ext2, [ext3, config]]
|
* Example2: [[ext1, config], ext2, [ext3, config]]
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user