473,386 Members | 1,693 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

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 1339
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: joe k. | last post by:
Can anyone help me. I'm trying to display this test.xml file using this fomat.xsl file using VB. I get an error "Missing mandatory attribute 'version'. Description: An unhandled exception...
15
by: Nathan | last post by:
I have an aspx page with a data grid, some textboxes, and an update button. This page also has one html input element with type=file (not inside the data grid and runat=server). The update...
4
by: Rob Richardson | last post by:
Greetings! I am working on an application that targets a Pocket PC running Windows CE and SQL Server CE. Almost all functions in the application use a Try block with a Catch block that looks...
1
by: Terry Olsen | last post by:
Is this the best way to see if a DOS executable is running? I tried getting process window titles but it takes longer and the window title could be any number of different names. I'm a little...
1
by: Marc | last post by:
Hi! I'm working with a C# client that calls a php web service. I've created a wrapper to call the service using .NET wsdl tool (adding a web reference). The call to the server works fine, it...
1
by: rouble | last post by:
Hi All, How do I verify if a field within an ADODB.Recordset is NULL ? I have tried the following two methods that I could think of: 1. If Not IsNothing(rs("fieldname")) Then something =...
8
by: Radu | last post by:
Hi. I have an ASP control on my page: <asp:Calendar ID="calStart" ................ Etc </asp:Calendar> and I have a Custom Validator defined as <asp:CustomValidator
3
by: Martin | last post by:
Hi. I need to identify the type of the exception in the universal handler (catch (...)) for debugging purposes. Point is that I write a testing console application, which must call some...
7
by: Michael Bray | last post by:
We have a control that is throwing an exception in a static initializer when viewed in VS2005 designer as a subcontrol on a form. The exception doesn't get thrown when designing the control...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.