Skip to content

Commit

Permalink
Handle exception when loading BTTV channel emoticons
Browse files Browse the repository at this point in the history
  • Loading branch information
onoderis committed Sep 2, 2017
1 parent b6d6e79 commit a5dec97
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions src/main/kotlin/failchat/core/AppStateTransitionManager.kt
Original file line number Diff line number Diff line change
Expand Up @@ -108,9 +108,13 @@ class AppStateTransitionManager(private val kodein: Kodein) {

// load BTTV channel emoticons in background
bttvApiClient.loadChannelEmoticons(channelName)
.thenAccept {
emoticonStorage.putCodeMapping(Origin.bttvChannel, it.map { it.code.toLowerCase() to it }.toMap())
emoticonStorage.putList(Origin.bttvChannel, it)
.thenApply<Unit> { emoticons ->
emoticonStorage.putCodeMapping(Origin.bttvChannel, emoticons.map { it.code.toLowerCase() to it }.toMap())
emoticonStorage.putList(Origin.bttvChannel, emoticons)
log.info("BTTV emoticons loaded for channel '{}', count: {}", channelName, emoticons.size)
}
.exceptionally { e ->
log.warn("Failed to load BTTV emoticons for channel '{}'", channelName, e)
}
}

Expand Down

0 comments on commit a5dec97

Please sign in to comment.