How do you handle exceptions and log errors securely within an automation script to prevent sensitive data exposure?