Catch error better for invalid rpc auth

This commit is contained in:
Matt 2014-03-09 13:28:39 -06:00
parent 4a088b19fc
commit a608380597

View File

@ -92,9 +92,15 @@ function DaemonInterface(options){
}
catch(e){
parsingError = e;
_this.emit('error', 'could not parse rpc data from method: ' + method +
' on instance ' + instance.index + ' data: ' + data);
if (res.statusCode === 401){
parsingError = 'unauthorized';
_this.emit('error', 'Invalid RPC username or password');
}
else{
parsingError = e;
_this.emit('error', 'could not parse rpc data from method: ' + method +
' on instance ' + instance.index + ' data: ' + data);
}
}
if (typeof(dataJson) !== 'undefined')
itemFinished(dataJson.error, dataJson.result);