Add try/catch to hasData method