Log SQL error and tweet to csv