simplify try .. catch block