If not able to connect with api catch the exception