If else block execution in appium fails to find the else block defined element

I ran across a problem using a if else block the else block does not execute when the if block fails to find the element , I get a no such element exception.

I tried the try and catch but still getting no such element exception , I really need your help , thanks