Which to catch first?

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I've got a C++/CLI winforms app that calls web services. I am trying to wrap
my calls the WS in a try/catch block and need to catch the following two
exceptions:

System.Net.WebException
Thrown when no connection to internet on client computer.

System.Web.Services.Protocols.SoapException
Thrown when WS server's SqlServer is unavailable (WS returns data from the
SqlServer).

I would like to know which one I should catch first?

Rasika.
 
Rasika said:
I've got a C++/CLI winforms app that calls web services. I am trying
to wrap my calls the WS in a try/catch block and need to catch the
following two exceptions:

System.Net.WebException
Thrown when no connection to internet on client computer.

System.Web.Services.Protocols.SoapException
Thrown when WS server's SqlServer is unavailable (WS returns data
from the SqlServer).

I would like to know which one I should catch first?

It makes no difference. Neither is derived from the other, so the order of
catches will have no effect on the meaning of the code.

-cd
 
Thank you.

Carl Daniel said:
It makes no difference. Neither is derived from the other, so the order of
catches will have no effect on the meaning of the code.

-cd
 
Back
Top