Skip to content

Instantly share code, notes, and snippets.

@giacecco
Created August 10, 2014 17:58
Show Gist options
  • Save giacecco/e12502289682c0751b20 to your computer and use it in GitHub Desktop.
Save giacecco/e12502289682c0751b20 to your computer and use it in GitHub Desktop.
Can't throw errors in the callback
var CONNECTION_PARAMETERS = {
'host': 'datafeeds.networkrail.co.uk',
'port': 61618,
'connectHeaders': {
'host': '/',
'login': process.env.NROD_USERNAME,
'passcode': process.env.NROD_PASSWORD,
'client-id': ((process.env.DEBUG !== 'true') ? process.env.NROD_USERNAME : undefined),
}
},
SUBSCRIPTION_PARAMETERS = {
'destination': '/topic/TRAIN_MVT_ALL_TOC',
'ack': 'client-individual',
};
var stompit = require('stompit');
var client = null,
uploadStream = null,
lastRecordWritten = null,
disconnectAtNextOpportunity = false;
var run = function () {
stompit.connect(CONNECTION_PARAMETERS, function (err, client) {
console.log("I am in before throwing an error");
throw new Error("foobar!");
console.log("I am in after throwing an errors");
});
}
run();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment