#include <iostream>
using namespace std;
class CustomException : public exception {
private:
string message;
public:
CustomException(const char* msg): message(msg) {}
const char* what() const throw()
{
return message.c_str();
}
};
void run()
{
throw CustomException("IllegalArgumentException");
}
/*
* global exception handling
*/
int main()
{
try
{
run();
}
catch (CustomException& ex)
{
cout << ex.what() << endl;
}
}