So I’m trying to be clever and consolidate the err...
# coroutines
s
So I’m trying to be clever and consolidate the error handling for some of my viewmodels. One of my ideas is just to wrap the viewModel launcher with something custom and add the error handling I need. Is this insane? So far it “works” but I’m not sure what other considerations I should have/diagnostics I should be looking for when wrapping a launcher like this.
Copy code
fun ViewModel.launchWithErrorHandling(block: suspend CoroutineScope.() -> Unit) : Job {
    return viewModelScope.launch {
        try {
             block()
        } catch (e: HttpException) {
            println("errRRRor")
        } catch (e: IOException) {
            println("IO NOOOO")
        }
    }
}