, . std::exception. , catch(std::exception&) (, - , - gazilion , ).
:
class MyException : public std::exception {
int x;
const char* y;
public:
MyException(const char* msg, int x_, const char* y_)
: std::exception(msg)
, x(x_)
, y(y_) {
}
int GetX() const { return x; }
const char* GetY() const { return y; }
};
...
try {
throw MyException("Shit just hit the fan...", 1234, "Informational string");
} catch(MyException& ex) {
LogAndShowMessage(ex.what());
DoSomething(ex.GetX(), ex.GetY());
}