add try catch exception handling