473,972 Members | 50,218 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

using default exception in catch(...)

Is there anyway that I can get at the actual exception in a catch(...)?

Dec 6 '06 #1
16 3812
* jo*********@gma il.com:
Is there anyway that I can get at the actual exception in a catch(...)?
throw

--
A: Because it messes up the order in which people normally read text.
Q: Why is it such a bad thing?
A: Top-posting.
Q: What is the most annoying thing on usenet and in e-mail?
Dec 6 '06 #2
I'd like to be able to look at the exception that was caught.
This would be immensely useful, for instance, in some sort of exception
handler one might have in main(), for instance.

Alf P. Steinbach wrote:
* jo*********@gma il.com:
Is there anyway that I can get at the actual exception in a catch(...)?

throw

--
A: Because it messes up the order in which people normally read text.
Q: Why is it such a bad thing?
A: Top-posting.
Q: What is the most annoying thing on usenet and in e-mail?
Dec 6 '06 #3
Don't

* jo*********@gma il.com:
I'd like to be able to look at the exception that was caught.
This would be immensely useful, for instance, in some sort of exception
handler one might have in main(), for instance.

Alf P. Steinbach wrote:
>* jo*********@gma il.com:
>>Is there anyway that I can get at the actual exception in a catch(...)?
throw
top-post or middle-post.
>>
--
A: Because it messes up the order in which people normally read text.
What part
>Q: Why is it such a bad thing?
A: Top-posting.
of the answer

>Q: What is the most annoying thing on usenet and in e-mail?
was it you didn't understand?

--
A: Because it messes up the order in which people normally read text.
Q: Why is it such a bad thing?
A: Top-posting.
Q: What is the most annoying thing on usenet and in e-mail?
Dec 6 '06 #4

Alf P. Steinbach wrote:
Don't

* jo*********@gma il.com:
I'd like to be able to look at the exception that was caught.
This would be immensely useful, for instance, in some sort of exception
handler one might have in main(), for instance.

Alf P. Steinbach wrote:
* jo*********@gma il.com:
Is there anyway that I can get at the actual exception in a catch(...)?
throw

top-post or middle-post.
>
--
A: Because it messes up the order in which people normally read text.

What part
Q: Why is it such a bad thing?
A: Top-posting.

of the answer

Q: What is the most annoying thing on usenet and in e-mail?

was it you didn't understand?

--
A: Because it messes up the order in which people normally read text.
Q: Why is it such a bad thing?
A: Top-posting.
Q: What is the most annoying thing on usenet and in e-mail?
Forgive me. I agree that top-posting is bad. Unfortunately most of the
world does it. Good luck with changing that.
Are you saying that since it is possible to throw nothing, the idea of
of getting at the exception caught by a default handler is foolish?
Help me in my ignorance.

Dec 6 '06 #5
Hi

jo*********@gma il.com wrote:
I'd like to be able to look at the exception that was caught.
This would be immensely useful, for instance, in some sort of exception
handler one might have in main(), for instance.
And how would you do that? What kind of inspection would you want to do? You
don't know the type of what has been thrown. It could be a double. Or a
member pointer. Or an object of type X...

Markus

Dec 6 '06 #6
Hi

jo*********@gma il.com wrote:
Are you saying that since it is possible to throw nothing, the idea of
of getting at the exception caught by a default handler is foolish?
Help me in my ignorance.
No, he is saying that there is only one thing you can do with the exception
caught in a catch-all handler, which is re-throwing the exception. This is
what
throw;
does. You cannot throw "nothing".

Markus

Dec 6 '06 #7
josephga...@gma il.com wrote:
Forgive me. I agree that top-posting is bad. Unfortunately most of the
world does it. Good luck with changing that.
All Alf is getting at is that you should do as the Romans do when in
Rome (cf.
http://www.parashift.com/c++-faq-lit....html#faq-5.4).
Are you saying that since it is possible to throw nothing, the idea of
of getting at the exception caught by a default handler is foolish?
Help me in my ignorance.
No, he's saying you can rethrow the exception by using "throw;" and
then catch the desired exceptions or class of exceptions (e.g.,
something in the std::exception hierarchy).

Cheers! --M

Dec 6 '06 #8
* jo*********@gma il.com:
>
Forgive me. I agree that top-posting is bad. Unfortunately most of the
world does it.
Not hereabouts.

And please don't quote signatures either.

:-)

Good luck with changing that.
No need, we only need to inform the newbies.

See FAQ item 5.2 or thereabouts (I forget the number).

It's nearly always a good idea to read the FAQ before posting.

Are you saying that since it is possible to throw nothing, the idea of
of getting at the exception caught by a default handler is foolish?
No.

Because it's impossible to throw nothing, it's very easy to get at the
exception.

IOW., what do you think "throw;" throws?

--
A: Because it messes up the order in which people normally read text.
Q: Why is it such a bad thing?
A: Top-posting.
Q: What is the most annoying thing on usenet and in e-mail?
Dec 6 '06 #9

Markus Moll wrote:
Hi

jo*********@gma il.com wrote:
I'd like to be able to look at the exception that was caught.
This would be immensely useful, for instance, in some sort of exception
handler one might have in main(), for instance.

And how would you do that? What kind of inspection would you want to do? You
don't know the type of what has been thrown. It could be a double. Or a
member pointer. Or an object of type X...

Markus
Obviously C++ has no base exception class like .net or java....

Dec 6 '06 #10

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

Similar topics

4
2287
by: Zork | last post by:
Hi, I am trying to stop object creation (in this case ill use a ball as the object) via use of exceptions. In essence, if the ball does not have an owner, I do not want the ball object created. Here is my program sketch: ------------------------- #include <sstream> class NullOwnerException : public exception
7
2714
by: Ekim | last post by:
hy, I've a question concerning exception-handling in c++: is there a possibility to catch any exception (I know one can do that by "catch(...)") and display its default-error-message (like in Java)? or do you have to create your own exceptions and make your own error-messages? I would only need the error-number or something like a short description which exception occured, and subsequently I want to write it to a logfile.
5
3829
by: Miyra | last post by:
Hi. I'm working with an app that uses exceptions for control flow. These are code blocks where exceptions are thrown/caught regularly. A couple hundred exceptions occur per hour and they're caught close to the point of origination. I'm trying to decide whether to refactor... What is the cost of throwing an exception in the CLR - relative to, say, a conditional statement? Are we taking talking 1+ orders of magnitude? Is there...
0
4306
by: ALI-R | last post by:
I am using the code below to open Outlook as user clicks on "Email this page" try { string subjectEmail=string.Format("Magnet Alert Center - Alerts for : {0}",Request.QueryString);
3
1803
by: Chris Baldwin | last post by:
Hello, I'm having a problem with a mixed managed/unmanaged DLL. When I attempt to reference "Exception" in my VB.NET code, it conflicts with some other "exception" that gets somehow gets into the assembly. This code reproduces the issue: #using <System.dll> // #include <vector> is in stdafx.h
6
17223
by: ransoma22 | last post by:
I developing an application that receive SMS from a connected GSM handphone, e.g Siemens M55, Nokia 6230,etc through the data cable. The application(VB.NET) will receive the SMS automatically, process and output to the screen in my application when a message arrived. But the problem is how do I read the SMS message immediately when it arrived without my handphone BeEPINg for new message ? I read up the AT commands, but when getting down...
1
2408
by: Anonieko | last post by:
Understanding and Using Exceptions (this is a really long post...only read it if you (a) don't know what try/catch is OR (b) actually write catch(Exception ex) or catch{ }) The first thing I look for when evaluating someone's code is a try/catch block. While it isn't a perfect indicator, exception handling is one of the few things that quickly speak about the quality of code. Within seconds you might discover that the code author...
7
10300
by: christian.eickhoff | last post by:
Hi Everyone, I am currently implementing an XercesDOMParser to parse an XML file and to validate this file against its XSD Schema file which are both located on my local HD drive. For this purpose I set the corresponding XercesDOMParser feature as shown in the upcoming subsection of my code. As far as I understand, the parsing process should throw an DOMException in case the XML file doesn't match the Schema file (e.g. Element...
4
8939
by: cj | last post by:
my old code Try Dim sw As New System.io.StreamWriter(fileName, True) sw.WriteLine(strToWrite) sw.Close() Catch End Try my new code
0
4168
by: shlim | last post by:
Currently I'm using VB.Net to perform a http/https multipart form post to a servlet. I'm able to perform the post using HttpWebrequest via GetRequestStream(). However, the servlet returned me with "The remote server returned an error: (500) Internal Server Error". Obviously, this means that I have not posted all the parameters as the servlet requested. But I just can't seem to find out what went wrong with my code. Hope someone can enlighten me,...
0
11805
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
11399
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
11555
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
10067
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
8451
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 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 a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
7599
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
6402
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
5143
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
3749
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.