use if/else instead of begin/rescue