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,4 +1,5 @@
import { Meteor } from 'meteor/meteor';
import { OHIF } from 'meteor/ohif:core';
const http = Npm.require('http');
const https = Npm.require('https');
@@ -52,14 +53,35 @@ function makeRequest(geturl, options, callback) {
}
let output = '';
resp.setEncoding('utf8');
resp.on('data', function(chunk) {
output += chunk;
resp.on('data', function(chunk){
output += chunk;
});
resp.on('end', function() {
callback(null, { data: JSON.parse(output) });
resp.on('error', function (responseError) {
OHIF.log.error('There was an error in the DICOMWeb Server')
OHIF.log.error(error.stack);
OHIF.log.trace();
callback(new Meteor.Error('server-internal-error', responseError.message), null);
});
resp.on('end', function(){
callback(null, { data: JSON.parse(output) });
});
});
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(new Meteor.Error('server-connection-error', requestError.message), null);
});
req.end();
}
@@ -67,7 +89,7 @@ const makeRequestSync = Meteor.wrapAsync(makeRequest);
DICOMWeb.getJSON = function(geturl, options) {
if (options.logRequests) {
console.log(geturl);
OHIF.log.info(geturl);
}
if (options.logTiming) {
@@ -81,7 +103,7 @@ DICOMWeb.getJSON = function(geturl, options) {
}
if (options.logResponses) {
console.log(result);
OHIF.log.info(result);
}
return result;