<why the catch is triggered? (Kotlin)> The url con...
# stackoverflow
u
why the catch is triggered? (Kotlin) The url contains a json file with the contents: {"event": "reg","value": "true"}. I try to get this content, but always catch is triggered. Where did I make a mistake? fun getData(): JSONObject { val testLinkDep = "https://myurl/dep.json" return try { val response = okHttpClient .newCall(Request.Builder().url(testLinkDep).build()) .execute() JSONObject(response.body?.string() ?: "{}") } catch (ex:...