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