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 cornerstoneWADOImageLoader from 'cornerstone-wado-image-loader';
|
||||
import dicomParser from 'dicom-parser';
|
||||
import { errorHandler } from '@ohif/core'
|
||||
|
||||
let initialized = false;
|
||||
|
||||
@ -35,6 +36,9 @@ export default function initWADOImageLoader(UserAuthenticationService) {
|
||||
xhr.setRequestHeader('Authorization', headers.Authorization);
|
||||
}
|
||||
},
|
||||
errorInterceptor: error => {
|
||||
errorHandler.getHTTPErrorHandler(error)
|
||||
},
|
||||
});
|
||||
|
||||
initWebWorkers();
|
||||
|
||||
@ -7,7 +7,7 @@ import {
|
||||
processSeriesResults,
|
||||
} from './qido.js';
|
||||
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 dcmjs from 'dcmjs';
|
||||
@ -52,11 +52,14 @@ function createDicomWebApi(dicomWebConfig, UserAuthenticationService) {
|
||||
const qidoConfig = {
|
||||
url: qidoRoot,
|
||||
headers: UserAuthenticationService.getAuthorizationHeader(),
|
||||
errorInterceptor: errorHandler.getHTTPErrorHandler(),
|
||||
|
||||
};
|
||||
|
||||
const wadoConfig = {
|
||||
url: wadoRoot,
|
||||
headers: UserAuthenticationService.getAuthorizationHeader(),
|
||||
errorInterceptor: errorHandler.getHTTPErrorHandler(),
|
||||
};
|
||||
|
||||
// TODO -> Two clients sucks, but its better than 1000.
|
||||
|
||||
@ -39,6 +39,14 @@ window.config = {
|
||||
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: {
|
||||
// /* Optional: Should return a React component to be rendered in the "Logo" section of the application's Top Navigation bar */
|
||||
// createLogoComponentFn: function (React) {
|
||||
|
||||
@ -14,6 +14,7 @@ import {
|
||||
HangingProtocolService,
|
||||
CineService,
|
||||
UserAuthenticationService,
|
||||
errorHandler
|
||||
// utils,
|
||||
} from '@ohif/core';
|
||||
|
||||
@ -62,6 +63,12 @@ function appInit(appConfigOrFunc, defaultExtensions) {
|
||||
UserAuthenticationService,
|
||||
]);
|
||||
|
||||
errorHandler.getHTTPErrorHandler = () => {
|
||||
if (typeof appConfig.httpErrorHandler === 'function') {
|
||||
return appConfig.httpErrorHandler;
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Example: [ext1, ext2, ext3]
|
||||
* Example2: [[ext1, config], ext2, [ext3, config]]
|
||||
|
||||
Loading…
Reference in New Issue
Block a user