KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
After going through some links on exception handling ( 1 , 2 , and 3 ), I know that C++ programs can throw pretty much anything as exceptions ( int , char* , string , exception class). I know that std::exception is the base class for standard exceptions thrown by the program. However, I'm trying to design a try ... catch block as such: try { MyFunc(); } catch (certain exceptions) { // deal with the exception accordingly } catch (the rest of the exceptions) { // deal with these accordingly } while MyFunc() contains the following: void MyFunc() { ... if (certain condition is true) throw exception; ... } The trouble is that in that part of MyFunc function, I'm not sure what type of exception I should throw. To keep the code clean by implementing my own exceptions class, I have no idea what would be a good way to implement such exceptions class.
Tags (comma-separated)
Save Edits
Cancel