Error trapping for missing environment variables