multi-exception cathing

bzbiz

Active member
Joined
Mar 17, 2003
Messages
34
Location
Emilia - Italy
Hi folks!

How can i catch different kind of exception?

explain:

try
.......................
......................
catch ex as exception | ex2 as system.someKind.Exception

end try

its possible?

Thanx in advance

ByeZ
BiZ
 
You can have many catch statements in your try, it can be used for different exceptions like you said.
Code:
try
.......................
...................... 
catch ex as exception

catch ex2 as system.someKind.Exception

end try
 
be careful with the order though - I beleive they are checked in turn and as all exceptions derive from System.Exception putting that first will catch every error and subsequent catch statments will be ignored.

e.g.

Code:
try 
    something iffy here
catch ex as SpecificException
    handle
catch ex as exception    Default handler

end try
 
Back
Top