scan in a try catch block