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:
1 parent
4c5dcfeab0
commit
af4b8b45f5
18 files changed
+285
-88
No files matched your search
@@ -1,4 +1,5 @@
|
||||
import { _ } from 'meteor/underscore';
|
||||
import { OHIF } from 'meteor/ohif:core';
|
||||
|
||||
// Uses NodeJS 'net'
|
||||
// https://nodejs.org/api/net.html
|
||||
@@ -62,10 +63,10 @@ Connection.prototype.addPeer = function(options) {
|
||||
//start listening
|
||||
peer.server = net.createServer();
|
||||
peer.server.listen(options.port, options.host, function() {
|
||||
console.log('listening on %j', this.address());
|
||||
OHIF.log.info('listening on', this.address());
|
||||
});
|
||||
peer.server.on('error', function(err) {
|
||||
console.log('server error %j', err);
|
||||
OHIF.log.info('server error', err);
|
||||
});
|
||||
peer.server.on('connection', nativeSocket => {
|
||||
//incoming connections
|
||||
@@ -90,13 +91,13 @@ Connection.prototype.selectPeer = function(aeTitle) {
|
||||
|
||||
Connection.prototype._sendFile = function(socket, sHandle, file, maxSend, metaLength, list) {
|
||||
var fileNameText = typeof file.file === 'string' ? file.file : 'buffer';
|
||||
console.log('Sending file ' + fileNameText);
|
||||
OHIF.log.info(`Sending file ${fileNameText}`);
|
||||
var useContext = socket.getContextByUID(file.context);
|
||||
var self = this;
|
||||
|
||||
PDU.generatePDatas(useContext.id, file.file, maxSend, null, metaLength, function(err, handle) {
|
||||
if (err) {
|
||||
console.log('Error while sending file');
|
||||
OHIF.log.info('Error while sending file');
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -119,7 +120,7 @@ Connection.prototype._sendFile = function(socket, sHandle, file, maxSend, metaLe
|
||||
});
|
||||
store.on('response', function(msg) {
|
||||
var statusText = msg.getStatus().toString(16);
|
||||
console.log('STORE reponse with status', statusText);
|
||||
OHIF.log.info('STORE reponse with status', statusText);
|
||||
var error = null;
|
||||
if (msg.failure()) {
|
||||
error = new Error(statusText);
|
||||
@@ -153,7 +154,7 @@ Connection.prototype.storeInstances = function(fileList) {
|
||||
return;
|
||||
}
|
||||
|
||||
console.log('Dicom file ' + (typeof bufferOrFile === 'string' ? bufferOrFile : 'buffer') + ' found');
|
||||
OHIF.log.info(`Dicom file ${(typeof bufferOrFile === 'string' ? bufferOrFile : 'buffer')} found`);
|
||||
lastProcessedMetaLength = metaLength;
|
||||
var syntax = metaMessage.getValue(0x00020010);
|
||||
var sopClassUID = metaMessage.getValue(0x00020002);
|
||||
@@ -248,6 +249,7 @@ Connection.prototype.addSocket = function(hostAE, socket) {
|
||||
};
|
||||
|
||||
Connection.prototype.associate = function(options, callback) {
|
||||
const self = this;
|
||||
var hostAE = options.hostAE ? options.hostAE : this.defaultPeer;
|
||||
var sourceAE = options.sourceAE ? options.sourceAE : this.defaultServer;
|
||||
|
||||
@@ -264,7 +266,7 @@ Connection.prototype.associate = function(options, callback) {
|
||||
socket.once('associated', callback);
|
||||
}
|
||||
|
||||
console.log('Starting Connection...');
|
||||
OHIF.log.info('Starting Connection...');
|
||||
|
||||
socket.setCalledAe(hostAE);
|
||||
socket.setCallingAE(sourceAE);
|
||||
@@ -279,7 +281,7 @@ Connection.prototype.associate = function(options, callback) {
|
||||
if (options.contexts) {
|
||||
socket.setPresentationContexts(options.contexts);
|
||||
} else {
|
||||
throw 'Contexts must be specified';
|
||||
throw new Meteor.Error('Contexts must be specified');
|
||||
}
|
||||
|
||||
socket.associate();
|
||||
|
||||
Reference in new issue
Block a user