C# Error I am not familiar with

I wrote this function:

public string CreateAttribute(String ProdID, int counter)
    {
        bool fireAgain = false;
        String strProdID = ProdID;
        String strFund = "";
        String strAppeal = "";
        String strPackage = "";
        int cnt = counter;
        // Build WC API complete URL
        string wcApiCompleteUrl = Variables.WCAPIBaseUrl + "/" + "products/" + strProdID + "/?" + "consumer_key=" + Variables.WCAPIConsumerKey + "&consumer_secret=" + Variables.WCAPIConsumerSecret;
        // Just some kind of debug output :-)
        ComponentMetaData.FireInformation(10, "Start - URL", String.Format("The following URL has been used: {0}", wcApiCompleteUrl), "", 0, fireAgain);

        try
        {
            //Call getWebServiceResult to return our WorkGroupMetric array
            WCProduct[] wcProductOutput = GetRestServiceResult1(wcApiCompleteUrl);

            ////For each group of metrics output records
            foreach (var wcProducts in wcProductOutput)
            {
                if (wcProducts.Attributes.Length == 0)
                {
                    strFund = "NONE";
                    strAppeal = "NONE";
                    strPackage = "NONE";
                }
                else
                {
                    foreach (var wcAttribute in wcProducts.Attributes)
                    {
                        if (wcAttribute.NameID == "Re-fund-member")
                        {
                            strFund = wcAttribute.options;
                        }
                        if (wcAttribute.NameID == "Re-appeal-code")
                        {
                            strAppeal = wcAttribute.options;
                        }
                        if (wcAttribute.NameID == "Re-package-code")
                        {
                            strPackage = wcAttribute.options;
                        }
                    }
                }
            }
            if (cnt == 1)
            {
                return strFund;
            }
            if (cnt == 2)
            {
                return strAppeal;
            }
            if (cnt == 3)
            {
                return strPackage;
            }
        }
        catch (Exception e)
        {
            FailComponent(e.ToString());
            return "";
        }
    }

The purpose of the function is simple. It has to return me Fund Name or Appeal Code or Package Code. Just one for each Function Call. What should be return depends on counter. I am getting error: "Error      2      'ScriptMain.CreateAttribute(string, int)': not all code paths return a value      C:\Users\rk688\AppData\Local\Temp\Vsta\SSIS_SC110\Vsta8rFSQ3hMmUy6TnLDJtcY8A\VstaSni__1__r7kUeV_uk8CyqoXQ\main.cs      360      19      SC_62c91189374d4fd6b180997972364e08" I cannot figure out what is wrong with the function. Can you help?
BurzhuinAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

AndyAinscowFreelance programmer / ConsultantCommented:
catch (Exception e)
        {
            FailComponent(e.ToString());
            return "";
        }
return "";
    }


In theory the function could exit after the catch without returning anything - see your error message.  Just add the line in bold (or return something other than an empty string if that makes more sense).

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
C#

From novice to tech pro — start learning today.