Linked Questions

485 votes
16 answers
117k views

I have always been of the belief that if a method can throw an exception then it is reckless not to protect this call with a meaningful try block. I just posted 'You should ALWAYS wrap calls that can ...
Konrad's user avatar
  • 41.1k
287 votes
16 answers
378k views

I want to have a way to report the stack trace to the user if an exception is thrown. What is the best way to do this? I'd like it to be portable if possible. I want information to pop up, so the user ...
rlbond's user avatar
  • 68.4k
408 votes
6 answers
722k views

I have a very poor understanding of exception handling(i.e., how to customize throw, try, catch statements for my own purposes). For example, I have defined a function as follows: int compare(int a, ...
Terry Li's user avatar
  • 17.3k
109 votes
14 answers
39k views

I've seen at least one reliable source (a C++ class I took) recommend that application-specific exception classes in C++ should inherit from std::exception. I'm not clear on the benefits of this ...
John M Gant's user avatar
  • 19.4k
144 votes
5 answers
93k views

Will the following append() in the catch cause the rethrown exception to see the effect of append() being called? try { mayThrowMyErr(); } catch (myErr &err) { err.append("Add to my message ...
WilliamKF's user avatar
  • 43.5k
85 votes
7 answers
189k views

I would like to throw an exception when my C++ methods encounter something weird and can't recover. Is it OK to throw a std::string pointer? Here's what I was looking forward to doing: void Foo::Bar(...
Palad1's user avatar
  • 863
34 votes
10 answers
30k views

Today, in my C++ multi-platform code, I have a try-catch around every function. In every catch block I add the current function's name to the exception and throw it again, so that in the upmost catch ...
Igor's user avatar
  • 27.4k
42 votes
6 answers
35k views

What is a good design for a set of exception classes? I see all sorts of stuff around about what exception classes should and shouldn't do, but not a simple design which is easy to use and extend ...
Fire Lancer's user avatar
  • 30.3k
13 votes
14 answers
8k views

I'm looking for an answer in MS VC++. When debugging a large C++ application, which unfortunately has a very extensive usage of C++ exceptions. Sometimes I catch an exception a little later than I ...
Brian R. Bondy's user avatar
13 votes
5 answers
21k views

I want to handle errors in my c++ program, so I created some exception classes to manage those errors, but I want to specify at which line in my program the error occurred. I passed LINE macro to the ...
CHAKRI's user avatar
  • 203
13 votes
4 answers
2k views

I just finished work on a C++-program where I've implemented my own exceptions (although derived from std::exception). The practice I've applied when one exception causes a chain reaction, propagating ...
gablin's user avatar
  • 4,848
1 vote
3 answers
2k views

I need to catch some "fatal" C++ exception, then flush logs and rethrow the former, with its own backtrace. My current solution, however, displays (correctly) the wrong stacktrace. #include &...
Patrizio Bertoni's user avatar
2 votes
2 answers
5k views

I'm writing a plugin (basically a dll) for a 3D application and occasionally there are crashes. Sometimes these are very difficult to find and I wanted to invest some time into making (or integrating ...
Anti-Distinctlyminty's user avatar
2 votes
5 answers
4k views

I would like too see the stacktrace after the exception is thrown of course using debugger. Normally, when the exception is never caught, the debugger stops the program after receiving SIGABRT and I ...
Rames's user avatar
  • 948
4 votes
4 answers
1k views

With python, when an exception occurs, I get detailed information about what file raised an error, even without a catch: def hello(): raise Exception; hello() Execution result >> ...
prosseek's user avatar
  • 193k

15 30 50 per page