01-29-2010, 04:06 PM
I'm dealing with converting a good portion of my drivers to either IP or serial. One of the challenges in that is to make sure I can break out of however deep I am if I have suddenly lost the socket connection, since the only thing that will fix that is a LostCommRes result.
If I catch an exception, I want to deal with it unless its a SocketErrors exception, in which case I want to rethrow it.
A given Try/Catch block can cover a ton of code and catch numerous different exception enumeration types. There is no function for checking if the exception is specifically a SocketErrors exception...only for testing a value within that enumeration. So, if I check that the exception is CheckGreater than the SocketErrors.NotConn, but the exception isn't even a SocketErrors exception (maybe it was a bad index into an array), will it still work correctly? Basically, will the CheckGreater always return false if the $Exception isn't of the enumerated type you're comparing it to? That *SHOULD* be correct, but I'm just checking.
If I catch an exception, I want to deal with it unless its a SocketErrors exception, in which case I want to rethrow it.
A given Try/Catch block can cover a ton of code and catch numerous different exception enumeration types. There is no function for checking if the exception is specifically a SocketErrors exception...only for testing a value within that enumeration. So, if I check that the exception is CheckGreater than the SocketErrors.NotConn, but the exception isn't even a SocketErrors exception (maybe it was a bad index into an array), will it still work correctly? Basically, will the CheckGreater always return false if the $Exception isn't of the enumerated type you're comparing it to? That *SHOULD* be correct, but I'm just checking.