views:

179

answers:

2

Hello,

I have a problem in catching an exception. I am trying to re throw an exception and I get a message: "There is no source code available for the current location".

The code is very simple:

#include <exception>
using namespace std;

try {
throw exception("asas");
}
catch (const exception& e) {
   cout<< "Error msg"<< e.what()<< endl;
   throw; //This the error message I get from the IDE.
}

It repetas also if I try to throw a string msg and try to re throe it Thanks

+1  A: 

It seems like you are stepping into the re-throw, and you probably don't have source code for the part of the code you stepped into. You will get those messages when the IDE can't find source code for the current line of code.

leiz
but this is the same application. This is not a DLL or any kind of library.
Roman Dorevich
@leiz, the problem is in the throw;
Ahmed Said
@Ahmed, that is what I said -- he is stepping into rethrow or something
leiz
+1  A: 

Your question is so misleading, it's very hard to give you back anything but more questions.

You write you get this message when you're trying to rethrow, but it's very unclear what you mean: Is this a compiler error, a run-time error, or something you get while you're debugging? If the latter (which I assume), why are you debugging? Isn't the thrown exception caught? If so, what's the code that attempts to catch it?

I suggest you change your question to show a small, but complete piece of code (ideally self-contained and compilable) plus a exact description of A) what happens and B) what you think should happen instead.

Meanwhile, all I can say is that the error message you quote might mean that you are running/debugging something that isn't compiled from the code you look at. But that#s about as vague as your question...

sbi
I am sorry from the misleading.I get it when debugging. Yes you are right I tried to run it without debug in it was ok. Why is the difference ? and how can I debug my application ?
Roman Dorevich
@Roman: I still have no idea what exactly you're doing, what happens, and what you expect to happen instead. Go and edit your question according to my suggestions. Maybe then someone will understand what's happening. As it is, I'm not even sure what you're talking about.
sbi