Minor Changes in Exception Handling Mechanism

I used std::cerr for print out the exception message.