Merge pull request #28 from matiu/feature/handle-403-HTTP

handle 403 status code
This commit is contained in:
Ryan X. Charles 2014-01-28 15:41:14 -08:00
commit be55042c44
1 changed files with 7 additions and 1 deletions

View File

@ -164,9 +164,14 @@ function ClassSpec(b) {
});
res.on('end', function() {
if(res.statusCode == 401) {
callback(new Error('bitcoin JSON-RPC connection rejected: unauthorized'));
callback(new Error('bitcoin JSON-RPC connection rejected: 401 unauthorized'));
return;
}
if(res.statusCode == 403) {
callback(new Error('bitcoin JSON-RPC connection rejected: 403 forbidden'));
return;
}
if(err) {
callback(err);
return;
@ -176,6 +181,7 @@ function ClassSpec(b) {
} catch(e) {
log.err(e.stack);
log.err(buf);
log.err('HTTP Status code:' + res.statusCode);
callback(e);
return;
}