Refactor error handling in Gates and OPC activities; replace raise statements with logging for better traceability