Users often define their own exceptions:
class MyApplicationError
{
public:
MyApplicationError(const string& r);
string& what() const;
private:
string reason;
};
MyApplicationError::MyApplicationError(const string& r)
: reason(r) {}
string& what() const
{
return reason;
}