try { // Block of code to try throw exception; // Throw an exception when a problem arise } catch (exception& e) { // Block to do something with the error (e.g. log it). throw; // This rethrows the error. }