Created
May 3, 2020 15:08
-
-
Save Runman44/ca9286fe6e1c1a9abc51ad84fec409bc to your computer and use it in GitHub Desktop.
No withContext
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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