mv try catch out of main function