Handle exception in there is no connection