How to explicit trap a Time Out exception?

  • Thread starter Thread starter Mario
  • Start date Start date
M

Mario

It seems to me that a "time out" exception is a fairly routine
exception that can occur either when I'm reading from or updating to a
database. That said, it's a bit curious that there is no built-in
exception for trapping a time out.

Presently, I simply trap a vanilla SqlException and then I check the
start of the message for the "Timeout expired." text. If I find it, I
recast the exception using a "new TimeoutException(ex)". I defined
this custom exception myself.

Doesn't it seem practical that the .NET framework would include a
native exception such as TimeoutException or SqlTimeoutException? Why
should I and thousands of other programmer have to parse the message
text?

How are others handling time out exceptions? Am I missing something?

Mario T. Lanza
Clarity Information Architecture, Inc.
 
Hello Mario,
May I ask if you are working with .NET 1.1 or 2.0?

if you are working with .NET 2.0: I have good news for you and the other
thousands of developers, Microsoft has embedded a new TimeoutException class
and here is its link http://msdn2.microsoft.com/en-us/library/system.timeoutexception.aspx

if you are using .NET 1.x I guess also that you might have missed something
regarding this exception, Check this link http://msdn.microsoft.com/library/d...mserviceprocesstimeoutexceptionclasstopic.asp

I am not quite sure of the .NET 1.x exception class if it meets your needs
or not.
Thanks

--
Khaled Hussein
Graduate Teaching Assistant
College of Computing and Information Technology
Arab Academy for Science and Technology and Maritime Transport
Web Site: http://www.aast.edu
(The power of imagination makes us infinite.)
 
Back
Top