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*
Usually you should derive your own exception classes from std::exception and its derivatives to represent errors relevant to your application domain, for example if you deal with files you should have FileNotFoundException that includes the filepath and other relevant information, this way you can create catch blocks to handle certain error types and leave out others, you should also refrain from throwing or catching non-class exceptions.
Have a look at similar exception hierarchies in .NET and Java to see how to model general errors(files errors, IO errors, network errors, etc)