Skip to content

Instantly share code, notes, and snippets.

@Runman44
Created May 3, 2020 15:08
Show Gist options
  • Save Runman44/ca9286fe6e1c1a9abc51ad84fec409bc to your computer and use it in GitHub Desktop.
Save Runman44/ca9286fe6e1c1a9abc51ad84fec409bc to your computer and use it in GitHub Desktop.
No withContext
suspend fun refreshTitle() {
try {
// Make network request using a blocking call
val result = network.fetchNextTitle()
titleDao.insertTitle(Title(result))
} catch (cause: Throwable) {
// If anything throws an exception, inform the caller
throw TitleRefreshError("Unable to refresh title", cause)
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment