combine two try-catch block into one, make it cleaner.

combine two try-catch block into one, make it cleaner.