How to Implement Custom Exceptions in C++
Under certain conditions, custom exceptions that are not predefined in C++ may be useful to generate. In C++, any type can be caught or thrown that matches some requirements. These are that the type should have a valid copy constructor and destructor. Custom exceptions provide relevant information about an error to the exception handling mechanism.