updated code in catch statement