codelab-kotlin-coroutines
codelab-kotlin-coroutines copied to clipboard
Missing "catch" in updated "getLastKnownLocation()" refactor
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
}