Check out example codes for "exception handling c++". It will help you in understanding the concepts better.

Code Example 1

try {
	//do
} catch (...){
	//if error do
}

Code Example 2

try {
  int age = 15;
  if (age > 18) {
    
    cout << "Access granted - you are old enough.";
  } else {
    
    throw 505;
  }
}
catch (int myNum) {
  
    cout << "Access denied - You must be at least 18 years old.\n";
  
    cout << "Error number: " << myNum; 
}

Code Example 3

// exceptions
#include <iostream>
using namespace std;

int main () {
  try
  {
    throw 20;
  }
  catch (int e)
  {
    cout << "An exception occurred. Exception Nr. " << e << '\n';
  }
  return 0;
}

Learn ReactJs, React Native from akashmittal.com