diff --git a/bin/libbfa.js b/bin/libbfa.js index bf0b61b7ab5a49878428908c75ec468f336c52b3..6cdd2e99ee9e3af22086bd9b680924e0c1c65454 100644 --- a/bin/libbfa.js +++ b/bin/libbfa.js @@ -96,11 +96,16 @@ module.exports = class Libbfa body: body, callback: function RPCresponse( err, obj ) { + var r; + var e; if ( err ) - throw new Error( err ); + e = err; + else if ( obj.body.error && obj.body.error.code && obj.body.error.message ) - throw new Error( 'Error ' + obj.body.error.code + ": "+ obj.body.error.message ); - callback(obj.body.result); + e = 'Error ' + obj.body.error.code + ": "+ obj.body.error.message; + else + r = obj.body.result; + callback(e, r); } }); }; diff --git a/bin/monitor.js b/bin/monitor.js index 0e84360244649e9826ed43312676c81426b91a92..4414f05d625c6b32c09af25ab58ddd38bd95ba39 100755 --- a/bin/monitor.js +++ b/bin/monitor.js @@ -120,13 +120,15 @@ function parsenode( node ) return n; } -function gotAdminPeers( nodelist ) +function gotAdminPeers( err, nodelist ) { var nowpeers = []; var peerscache = readPeersCache(); var newoutpeers = []; var currentnodes = []; + if ( err ) + return; // The nodelist also contains peers which are not yet validated // if they even belong to this network. Parsenode returns an // object or nothing, based on our criteria @@ -208,8 +210,9 @@ function mayseal() // Get a list of clique.getSigners, so we can see if we are // in the list of authorized sealers. web3.bfa.clique.getSigners( - function gotListOfSealers(x) + function gotListOfSealers(e,x) { + if (e) return; var lcsealers = x.map( name => name.toLowerCase() ); var isSigner = (lcsealers.indexOf(me) > -1); if ( isSigner ) @@ -245,8 +248,9 @@ function unlock() return; var unlockedsomething = false; web3.bfa.personal.listWallets( - function pushone(x) + function pushone(e,x) { + if (e) return; var i = x.length; var wallets = new Array(); while ( i-- > 0 ) @@ -302,7 +306,16 @@ function unlock() function timer() { if ( netid == 0 ) - web3.eth.net.getId().then( x => {netid = x} ); + { + web3.eth.net.getId() + .then( x => { + netid = x; + } ) + .catch( err => { + console.log("monitor.js non-fatal: "+err) + }); + return; + } peerlist(); mayseal(); unlock(); diff --git a/bin/singlestart.sh b/bin/singlestart.sh index a0dda3160368a3d28b99eb69b73728fa87b254de..b6f97e84c7d9b686f53b01f4362649350fa503c1 100755 --- a/bin/singlestart.sh +++ b/bin/singlestart.sh @@ -48,7 +48,7 @@ unset LOGDIR LOGPIPE PIDLIST echo "*** Setting up logging." # Clean up logging -LOGDIR=$( mktemp --directory ) +LOGDIR=$( mktemp -d ) trap "rm -f ${LOGDIR}" EXIT LOGPIPE=${LOGDIR}/logpipe mknod ${LOGPIPE} p