473,386 Members | 1,830 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.

Can I have my own default Exception class

Hi,

I am writing error handling mechanism for a large website and one of
the requirements that has come is whether it is possible to have the
..NET application whenever it throws exception it throws a custom
defined exception. For e.g.
Default behaviour is as shown:
Try
some code
Catch Ex as Exception

End try

Can I have something like for all types of exceptions

Try
some code
Catch Ex as MyException

End try

This should be the default behaviour of my .NET application

Regards

Parag
Nov 20 '05 #1
2 930
Yes, you can do what you asked, you can actually have multipul catch
statements within the try to catch different types of exceptions to.

Mike Bulava

"Parag" <pa*******@yahoo.com> wrote in message
news:7a**************************@posting.google.c om...
Hi,

I am writing error handling mechanism for a large website and one of
the requirements that has come is whether it is possible to have the
.NET application whenever it throws exception it throws a custom
defined exception. For e.g.
Default behaviour is as shown:
Try
some code
Catch Ex as Exception

End try

Can I have something like for all types of exceptions

Try
some code
Catch Ex as MyException

End try

This should be the default behaviour of my .NET application

Regards

Parag

Nov 20 '05 #2
Parag,
In addition to Mike's comments.

To define your own exceptions simply inherit from
System.ApplicationException or System.SystemException.

You can inherit from System.Exception itself, however that is not
recommended.

You may want to consider defining MyBaseException that all your user
exceptions inherit from.

For the .NET guidelines on creating exceptions see:
http://msdn.microsoft.com/library/de...Guidelines.asp

Hope this helps
Jay

"Parag" <pa*******@yahoo.com> wrote in message
news:7a**************************@posting.google.c om...
Hi,

I am writing error handling mechanism for a large website and one of
the requirements that has come is whether it is possible to have the
.NET application whenever it throws exception it throws a custom
defined exception. For e.g.
Default behaviour is as shown:
Try
some code
Catch Ex as Exception

End try

Can I have something like for all types of exceptions

Try
some code
Catch Ex as MyException

End try

This should be the default behaviour of my .NET application

Regards

Parag

Nov 20 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: Mike Chirico | last post by:
Interesting Things to Know about MySQL Mike Chirico (mchirico@users.sourceforge.net) Copyright (GPU Free Documentation License) 2004 Last Updated: Mon Jun 7 10:37:28 EDT 2004 The latest...
6
by: James Radke | last post by:
Hello, I have a multithreaded windows NT service application (vb.net 2003) that I am working on (my first one), which reads a message queue and creates multiple threads to perform the processing...
12
by: Plop69 | last post by:
need some help on following: xml file 1 <TEST xmlns="http://test" > <OK>mlkddflmkj</OK> </TEST>
0
by: aboutjav.com | last post by:
Hi, I need some help. I am getting this error after I complete the asp.net register control and click on the continue button. It crashed when it tries to get it calls this Profile property ...
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: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
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: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
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
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.