Exception handeling for serial connection