add exception handler in thread