Forums
New posts
Search forums
Members
Current visitors
Log in
Register
What's new
Search
Search
Search titles only
By:
New posts
Search forums
Menu
Log in
Register
Install the app
Install
Forums
Archive
Archive
C++
Getting info about an unknown exception
JavaScript is disabled. For a better experience, please enable JavaScript in your browser before proceeding.
You are using an out of date browser. It may not display this or other websites correctly.
You should upgrade or use an
alternative browser
.
Reply to thread
Message
[QUOTE="Salt_Peter, post: 3651875"] No, unless you equip the program to do so (add relevent catch clauses to capture other specific exceptions). In the case where standardized exceptions come into play, at least add a catch block for std::exception. If coders stuck to using the existing hierarchy, life would be much simpler, ie: #include <iostream> #include <stdexcept> // std::runtime_error is a derivative of std::exception class SomeException : public std::runtime_error { public: SomeException( const char* ps ) : std::runtime_error( ps ) { } }; int main() { try { throw SomeException("error in main()"); } catch( const std::exception& e ) { std::cout << e.what() << std::endl; } catch( ... ) { std::cout << "unknown exception\n"; } } /* error in main() */ [/QUOTE]
Verification
Post reply
Forums
Archive
Archive
C++
Getting info about an unknown exception
Top