codelab-kotlin-coroutines icon indicating copy to clipboard operation
codelab-kotlin-coroutines copied to clipboard

Missing "catch" in updated "getLastKnownLocation()" refactor

Open undeadly opened this issue 5 years ago • 0 comments
trafficstars

try {
        val lastLocation = fusedLocationClient.awaitLastLocation();
        // process lastLocation here if needed
        showLocation(R.id.textView, lastLocation)
    } (e: Exception) {
        // we can do regular exception handling here or let it throw outside the function
    }

should be:

try {
        val lastLocation = fusedLocationClient.awaitLastLocation();
        // process lastLocation here if needed
        showLocation(R.id.textView, lastLocation)
    } catch (e: Exception) {
        // we can do regular exception handling here or let it throw outside the function
    }

undeadly avatar Mar 02 '20 18:03 undeadly