Adds error message if write to database is unsuccessful