implemented exception handler for repl mode