Centralized error handling.