473,395 Members | 2,446 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,395 software developers and data experts.

Throwing Nice Exceptions

I have a point in my code where I can get an exception if the network is not
available. This exception is kind of ugly for the user to see. I'd like to
catch and throw new exception that contains only my error string and an OK
button. If I say throw new System.Exception("The network is not available,
the list will not contain data."), the user sees text they don't need to see,
and they have to choose between break and continue buttons.

Any ideas?
--
Randy
May 10 '06 #1
3 933
"randy1200" <ra*******@newsgroups.nospam> wrote in message
news:CE**********************************@microsof t.com...
I have a point in my code where I can get an exception if the network is
not
available. This exception is kind of ugly for the user to see. I'd like to
catch and throw new exception that contains only my error string and an OK
button. If I say throw new System.Exception("The network is not available,
the list will not contain data."), the user sees text they don't need to
see,
and they have to choose between break and continue buttons.

Any ideas?
--
Randy


Maybe I misunderstand something, but why don't you just catch the exception
and handle it the way you like it.

Marcus
May 11 '06 #2
>I have a point in my code where I can get an exception if the network is
not
available. This exception is kind of ugly for the user to see. I'd like to
catch and throw new exception that contains only my error string and an OK
button. If I say throw new System.Exception("The network is not available,
the list will not contain data."), the user sees text they don't need to
see,
and they have to choose between break and continue buttons.


Exception with an OK button is a very nice idea.
--
Vladimir Nesterovsky
May 11 '06 #3
randy1200 <ra*******@newsgroups.nospam> wrote in
news:CE**********************************@microsof t.com:
I have a point in my code where I can get an exception if the network
is not available. This exception is kind of ugly for the user to see.
I'd like to catch and throw new exception that contains only my error
string and an OK button. If I say throw new System.Exception("The
network is not available, the list will not contain data."), the user
sees text they don't need to see, and they have to choose between
break and continue buttons.

Any ideas?


That sounds interesting, how is that done?

Is there a C++ only equivalent?
May 15 '06 #4

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

Similar topics

5
by: Mark Oueis | last post by:
I've been struggling with this question for a while. What is better design? To design functions to return error codes when an error occures, or to have them throw exceptions. If you chose the...
21
by: mihai | last post by:
People say that is a bad technique to throw exception from constructors; and that the solution would be to create a function _create_ to initialize an object. What about copy constructors? How...
40
by: Kevin Yu | last post by:
is it a bad programming design to throw exception in the try block then catch it??
40
by: Sek | last post by:
Is it appropriate to throw exception from a constructor? Thats the only way i could think of to denote the failure of constructor, wherein i am invoking couple of other classes to initialise the...
6
by: Marvin Barley | last post by:
I have a class that throws exceptions in new initializer, and a static array of objects of this type. When something is wrong in initialization, CGI program crashes miserably. Debugging shows...
1
by: usenet | last post by:
I wrote some sample code (see below) for nested exception throwing i.e. my catch blocks are throwing exceptions of their own (for simplicity I used standard exceptions). I am getting some...
4
by: Jay Dee | last post by:
I have a query about throwing exceptions. To throw an exception I type something like: try { // do somthing } catch (ArgumentOutOfRangeException) {
3
balabaster
by: balabaster | last post by:
Hey all, this might seem somewhat remedial but I'm unable to find any documentation on it - it pertains to throwing exceptions within a DLL. I've written a DLL that contains a bunch of classes....
21
by: Chris M. Thomasson | last post by:
Is it every appropriate to throw in a dtor? I am thinking about a simple example of a wrapper around a POSIX file... ________________________________________________________________________ class...
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
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
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
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,...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

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.