I have a cron job that runs every minute. Every once in a while the cron fails with the error:
MySQL server has gone away
The problem is that all the query below this error are executed and may sometimes give undesirable result.
So how do I detect that the error has occurred and exit execution of rest of the code?
Or any hint on how to fix the error in the first place would be great.