rethrow

C++ Exceptions questions on rethrow of original exception

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 here"); throw; // Does the rethrow exception reflect the call to append()? } Similarly, if I rewrite it this way, will bit slicing occur if ...

How to detect a bad way of re-throwing a C# Exception using StyleCop or VS2010?

My colleagues are seasoned C++ hackers switching to .Net. One of the mistakes that they make unintentionally is writing code like this: catch(ArgumentExcepttion ae) { // Code here logs the exception message // And this is supposed to re-throw the exeception throw ae; // as opposed to throw; // But, as we all know, doing ...

Throw VS rethrow : same result ?

Hello, refering to a lot of documentation on the net, particularly on SO, eg : http://stackoverflow.com/questions/178456/what-is-the-proper-way-to-re-throw-an-exception-in-c there should be a difference between "throw e;" and "throw;". But, from : http://bartdesmet.net/blogs/bart/archive/2006/03/12/3815.aspx, this code : using System...

Will C++ throw with no arguments work inside another frame to rethrow an exception?

If I have a code like the following: try { doSomething(); } catch (...) { noteError(); } void noteError() { try { throw; } catch (std::exception &err) { std::cerr << "Note known error here: " << err.what(); } catch (...) { std::cerr << "Note unknown error here."; } throw; } Will the original exceptions get t...

C++ re throw Exception gives error

I'm trying to catch a 'specific' exception (FormatException^ or OverflowException^) and then re throw it and catch it in the 'general' exception (Exception^) catch block. When run, I give it a format exception through input. I then get this error in a dialog box: "An unhandled exception of type 'System.FormatException' occurred in Futu...