0

In Service class I have Post method:

    public void Post(UpdateAdd request)
    {
        try
        {
            Service.Db.Insert(some_data);
        }
        catch (SqlException e)
        {
            switch (e.Number)
            {
                case SqlErrorNumbers.UniqueIndex: 
                    throw new UniqueIndexException();
            }
        }
    }

When I hit F5 (Debug->Run) service code stops at end of catch and says: "UniqueIndexException was unhandled by user code" and in my client code I must catch general WebException not WebServiceException like doc says here.

What I'm missing?

How to make that throwing new UniqueIndexException(); do not stops my code execution when run in Debug mode and how to know that UniqueIndexException() was thrown in service. InnerException of WebException is null.

Tomasito
  • 1,864
  • 1
  • 20
  • 43

0 Answers0