AvailabilityDetector: catch HttpExceptions

This commit is contained in:
Johan von Forstner
2020-04-13 13:12:22 +02:00
parent c800cca21e
commit cc5dd148fc

View File

@@ -17,6 +17,7 @@ import kotlinx.coroutines.launch
import kotlinx.coroutines.withContext
import retrofit2.Call
import retrofit2.Callback
import retrofit2.HttpException
import retrofit2.Response
import java.io.IOException
@@ -122,6 +123,9 @@ class MapViewModel(geApiKey: String) : ViewModel() {
} catch (e: IOException) {
value = Resource.error(e.message, null)
e.printStackTrace()
} catch (e: HttpException) {
value = Resource.error(e.message, null)
e.printStackTrace()
} catch (e: AvailabilityDetectorException) {
value = Resource.error(e.message, null)
e.printStackTrace()