Add try catch for r.connect