#include <iostream>
#include "TROOT.h"
void ThrowException() {

  const char* msg = "Beam me up Scotty!";
  std::cout << "About to throw the message " << msg << std::endl;
  throw(msg);
}

void TestExceptionWithRoot() {

  std::cout << "\n\nCalling code that does the throw directly ..." << std::endl;
  try {
    ThrowException(); 
  }
  catch(const char* msg) {
    std::cout << "Caught the message " << msg << std::endl;
  }
  
  std::cout << "\n\nCalling code that does the throw via ProcessLineFast ..." << std::endl;
  try {
    gROOT->ProcessLineFast("ThrowException()");
  }
  catch(const char* msg) {
    std::cout << "Caught the message " << msg << std::endl;
  }
  
}

