473,382 Members | 1,238 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,382 software developers and data experts.

displaying exception message from custom exception

Hi,

I made a custom exception, derived from ApplicationException. If the
exception is thrown, the erroring web page shows the line of code where
I throw exception, and doesn't display the exception message. Do I
need to catch my custom exception, and rethrow it as another type of
exception to make the message display?

I still want to page to error out, I don't want to catch it and return
a user-friendly message or anything. The page needs to error so that
operations will know errors are being thrown.

Thanks

Aug 18 '06 #1
2 1489
I asked the same question at 11:24 am and no response yet. Where is
everyone?

--

<bd*****@pacbell.netwrote in message
news:11*********************@p79g2000cwp.googlegro ups.com...
Hi,

I made a custom exception, derived from ApplicationException. If the
exception is thrown, the erroring web page shows the line of code where
I throw exception, and doesn't display the exception message. Do I
need to catch my custom exception, and rethrow it as another type of
exception to make the message display?

I still want to page to error out, I don't want to catch it and return
a user-friendly message or anything. The page needs to error so that
operations will know errors are being thrown.

Thanks

Aug 18 '06 #2
see
http://www.aspnetresources.com/blog/...ion_class.aspx

What I do is this.. which isn't what you want.

try

{

// web page stuff

}

catch(Exception ex)
{
Response.Write (ex.Message);
// or this
/*
if(null!=ex.InnerExeption)
{
Response.Write(ex.InnerException.Message);
}
*/
}
Ok.. having said that.. then yeah. do this.

try
{
//web stuff
}

catch(MyNamespace.MyException mex)
{
throw new SuperFriendlyException("MyException was thrown, but I don't
want to show you its info");
}
catch(Exception ex)
{
throw new SuperFriendlyException("ex was thrown, but I don't want to
show you its info");
}

Something like that.

Note, MyException is not the same object as SuperFriendlyException

<bd*****@pacbell.netwrote in message
news:11*********************@p79g2000cwp.googlegro ups.com...
Hi,

I made a custom exception, derived from ApplicationException. If the
exception is thrown, the erroring web page shows the line of code where
I throw exception, and doesn't display the exception message. Do I
need to catch my custom exception, and rethrow it as another type of
exception to make the message display?

I still want to page to error out, I don't want to catch it and return
a user-friendly message or anything. The page needs to error so that
operations will know errors are being thrown.

Thanks

Aug 18 '06 #3

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

Similar topics

2
by: Rajeev Soni | last post by:
Hi, Considering the scenario for handling exceptions in Web Application where we have Presentation layer, Business layer and Data Access layer; if there any exception is occurred in DAL, what is...
6
by: Vadivel Kumar | last post by:
I've a problem in handling a custom exception The following is my custom exception class: public class AppException : public Exception { public AppException (string message, Exception...
9
by: MR | last post by:
I get the following Exception "The data at the root level is invalid. Line 1, position 642" whenever I try to deserialize an incoming SOAP message. The incoming message is formed well and its...
3
by: Dan | last post by:
Hi all! When I throw my custom Exception class the first time in my code, the compiler takes a lot of time for find the following catch EX: try Throw New MyCustomException("test")
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
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: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
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: 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...

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.