Use multiple catch statements.
#include <iostream> using namespace std; void myFunction(int test) { try{ if(test) throw test; // throw int else throw "Value is zero"; // throw char * } catch(int i) { cout << "Caught One! Ex. #: " << i << '\n'; } catch(char *str) { cout << "Caught a string: "; cout << str << '\n'; } } int main() { cout << "start\n"; myFunction(1); myFunction(2); myFunction(0); myFunction(3); cout << "end"; return 0; }