feat: configuration to hook into XHR Error handling

* Error handling.

* Fix error handling, add redirect example.

* remove debugger

* docs: whitelabeling and httpErrorHandler

* bump dicomweb-client version

* bump cornerstone-wado-image-loader version

* Add more documentation around httpErrorHandler callback

* test: add errorHandler as an expected top level export

Co-authored-by: dannyrb <danny.ri.brown@gmail.com>
This commit is contained in:
James Pettsanddannyrb authored and GitHub committed 2020-04-22 22:01:34 -04:00
1 parent 273f31ad56
commit e96205de35
23 files changed
+227 -76

No files matched your search

@@ -1,5 +1,6 @@
import { httpErrorToStr, checkDicomFile } from '../utils/helpers';
import { api } from 'dicomweb-client';
import { errorHandler } from '@ohif/core';
class DicomUploadService {
async smartUpload(files, url, uploadCallback, cancellationToken) {
@@ -22,8 +23,7 @@ class DicomUploadService {
let error = null;
try {
if (chunk.length > 1) throw new Error('Not implemented');
if (chunk.length === 1)
await this.simpleUpload(chunk[0], url);
if (chunk.length === 1) await this.simpleUpload(chunk[0], url);
} catch (err) {
// It looks like a stupid bug of Babel that err is not an actual Exception object
error = httpErrorToStr(err);
@@ -76,11 +76,12 @@ class DicomUploadService {
getClient(url) {
const headers = this.retrieveAuthHeaderFunc();
const errorInterceptor = errorHandler.getHTTPErrorHandler();
// TODO: a bit weird we are creating a new dicomweb client instance for every upload
return new api.DICOMwebClient({
url,
headers
headers,
});
}
}