change the way to handle exceptions

in the main loop, RunTimeException need catche too, otherwise program would stop when it's unexpected.