I have a problem in catching an exception. I am trying to rethrow 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 also repeats if I try to throw a string message and try to rethrow it.
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 andB)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…