(Need assistance with JS error checking/trapping) Blynk on RPi occasional TCP timeout errors, must restart client

The “RPI using Blynk as a client” community seems a little low in percentage here and this JS error trapping issue is not anywhere near Blynk relivent, so it is unlikely we will find the magic bullet point that answers this question here.

But there was another JavaScript based topic that ended up with some more example sketches… including the requisite error trapping routines (and there seems to be a few ways of doing that)… but anyhow, more data to dig through is better than less :wink:

I broke out a couple of routines that have some form of error checking/trapping… and commented my best guesses as to what the steps are doing… I am basically just banging sticks together to see what happens :stuck_out_tongue_winking_eye:

// "run the command ifconfig"
v5.on('write', function(param) {  		// Watches for V5 Button

	console.log('V5:', param[0]);  		// prints value to CLI
		if (param == 1) {				// Runs the CLI command ifconfig if the button on V5 is pressed
			process.exec('ifconfig',function (err,stdout,stderr) {  // Including error check
    				if (err) {  // If error returns in data...
        			console.log("\n"+stderr);  // ...show something in log file?
    				} else {
        			console.log(stdout);  // ...else close log file?
    				}
			})
		}
});
//turn on ecasound (analog input) and turn off others
v3.on('write', function(param) {
child = exec('sudo systemctl stop shairport-sync ;\
	sudo /etc/init.d/squeezelite stop ;\
	ecasound -C -q -B:rt -b:1024 -f:16,2,48000 -i:alsahw,1,0',
    function (error, stdout, stderr) { // Including error check
        console.log('stdout: ' + stdout);
        console.log('stderr: ' + stderr);
        if (error !== null) {   // If error returns in data...
             console.log('exec error: ' + error);  // ...show something in in log file?
        }
    });