added slightly better error logging

This commit is contained in:
fisch0920 2014-05-12 01:14:24 -04:00
parent 5064a05dde
commit a69ee07871

View File

@ -150,7 +150,7 @@ Tracker.prototype._requestHttp = function (requestUrl, opts) {
var data = ''
if (res.statusCode !== 200) {
res.resume() // consume the whole stream
self.client.emit('error', new Error('Invalid response code ' + res.statusCode + ' from tracker'))
self.client.emit('error', new Error('Invalid response code ' + res.statusCode + ' from tracker ' + requestUrl))
return
}
res.on('data', function (chunk) {
@ -181,7 +181,7 @@ Tracker.prototype._requestUdp = function (requestUrl, opts) {
}
function error (message) {
self.client.emit('error', new Error(message))
self.client.emit('error', new Error(message + ' (connecting to tracker ' + requestUrl + ')'))
socket.close()
clearTimeout(timeout)
}