try catch instead of if else for w