Created
August 10, 2014 17:58
-
-
Save giacecco/e12502289682c0751b20 to your computer and use it in GitHub Desktop.
Can't throw errors in the callback
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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