Add Meteor.Errors to DIMSE startup for easier configuration debugging

This commit is contained in:
Erik Ziegler 2016-08-09 11:16:56 +02:00
parent ba76a89e13
commit fe8d256037

View File

@ -61,11 +61,18 @@ Meteor.startup(function() {
// TODO: [custom-servers] use active server and check if type is DIMSE // TODO: [custom-servers] use active server and check if type is DIMSE
var peers = Meteor.settings.servers.dimse[0].peers; var peers = Meteor.settings.servers.dimse[0].peers;
if (!peers || !peers.length) {
throw new Meteor.Error('dimse-config', 'No DIMSE Peers provided.');
}
console.log('Adding DIMSE peers'); console.log('Adding DIMSE peers');
if (peers && peers.length) { try {
peers.forEach(function(peer) { peers.forEach(function(peer) {
conn.addPeer(peer); conn.addPeer(peer);
}); });
} catch(error) {
console.warn('dimse-addPeers: ' + error);
throw new Meteor.Error('dimse-addPeers', error);
} }
}); });
@ -75,11 +82,16 @@ DIMSE.associate = function(contexts, callback, options) {
}; };
options = Object.assign(defaults, options); options = Object.assign(defaults, options);
conn.associate(options, function(pdu) { try {
// associated conn.associate(options, function(pdu) {
console.log('==Associated'); // associated
callback.call(this, pdu); console.log('==Associated');
}); callback.call(this, pdu);
});
} catch(error) {
console.warn('dimse-associate: ' + error);
throw new Meteor.Error('dimse-associate', error);
}
}; };
DIMSE.retrievePatients = function(params, options) { DIMSE.retrievePatients = function(params, options) {