Adding logging for error case