469,632 Members | 1,730 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,632 developers. It's quick & easy.

How to tell the type of exception

I have a custom exception which gets thrown in my business layer. I catch it
in the item inserted event of my formview. How do I tell whether it is a
custom error or another type of error. Is there a way of saying is
"e.exception of type custom error". Regards, Chris.
Jul 23 '07 #1
2 1264
Is it as simple as

If TypeOf obj Is TextBox Then...

I've logged off from my development machine and can't get access right now.
"Chris" <no****@nospam.comwrote in message
news:%2****************@TK2MSFTNGP04.phx.gbl...
>I have a custom exception which gets thrown in my business layer. I catch
it in the item inserted event of my formview. How do I tell whether it is a
custom error or another type of error. Is there a way of saying is
"e.exception of type custom error". Regards, Chris.

Jul 23 '07 #2
If you need to handle different exceptions in different ways, you should use
multiple catch blocks (sorry for the C#):

try
{
// ...
}
catch (MyException e)
{
// handle my exceptions
}
catch (Exception e)
{
// handle all other exceptions
}
"Chris" <no****@nospam.comwrote in message
news:uN**************@TK2MSFTNGP06.phx.gbl...
Is it as simple as

If TypeOf obj Is TextBox Then...

I've logged off from my development machine and can't get access right
now.
"Chris" <no****@nospam.comwrote in message
news:%2****************@TK2MSFTNGP04.phx.gbl...
>>I have a custom exception which gets thrown in my business layer. I catch
it in the item inserted event of my formview. How do I tell whether it is
a custom error or another type of error. Is there a way of saying is
"e.exception of type custom error". Regards, Chris.

Jul 23 '07 #3

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

1 post views Thread by Terry Olsen | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.