Ohif 168 proper error handling (#111)

* Adding a better error handling for DICOMWeb getJson method

* Adding a better error handling for DICOMWeb getBulkData method

* Fixinf some typos. Using console.error to log errors

* Better error handling for DIMSE connections

* Using meteor error in StudyListSearch to better display same error in the client

* Using Meteor.Error for a better pattern. Added an error message in the study list. created connection error types to DICOMWeb connection errors

* Changing error types for server connection. Added better errors for DIMSE server on sockets

* Improving viewer response to error being throw when not finding server to display studies

* OHIF-168: adding catches clauses for retrieveStudyMetada method

* OHIF-168: fixing typo in DIMSE.js

* OHIF-168: setting the session variable  to false when starting a new studylist search

* OHIF-168: Using OHIF.log instead of console

* OHIF-168: removing parsing into string for OHIF.log in Connection.js

* OHIF-168: improving error message visibility in study viewer
This commit is contained in:
André Botelho Almeida authored and Erik Ziegler committed 2017-09-19 17:44:39 +02:00
1 parent 4c5dcfeab0
commit af4b8b45f5
18 files changed
+285 -88

No files matched your search

@@ -1,3 +1,5 @@
import { OHIF } from 'meteor/ohif:core';
const ASCII = 'ascii';
const http = Npm.require('http')
const url = Npm.require('url');
@@ -165,6 +167,14 @@ function makeRequest(geturl, options, callback) {
data.push(chunk);
});
resp.on('error', function (responseError) {
OHIF.log.error('There was an error in the DICOMWeb Server');
OHIF.log.error(responseError.stack);
OHIF.log.trace();
callback(responseError, null);
});
resp.on('end', function() {
try {
callback(null, parseResponse(resp.headers, Buffer.concat(data)));
@@ -175,6 +185,15 @@ function makeRequest(geturl, options, callback) {
});
req.on('error', function (requestError) {
OHIF.log.error('Couldn\'t connect to DICOMWeb server.');
OHIF.log.error('Make sure you are trying to connect to the right server and that it is up and running.');
OHIF.log.error(requestError.stack);
OHIF.log.trace();
callback(requestError, null);
});
req.end();
}
@@ -185,7 +204,7 @@ const makeRequestSync = Meteor.wrapAsync(makeRequest);
DICOMWeb.getBulkData = function(geturl, options) {
if (options.logRequests) {
console.log(geturl);
OHIF.log.info(geturl);
}
if (options.logTiming) {
@@ -199,7 +218,7 @@ DICOMWeb.getBulkData = function(geturl, options) {
}
if (options.logResponses) {
console.log(result);
OHIF.log.info(result);
}
if (!Buffer.isBuffer(result)) {