Changed try-catch logic