Skip to content

Commit

Permalink
Fix error handling
Browse files Browse the repository at this point in the history
  • Loading branch information
sdercolin committed Apr 8, 2024
1 parent 9c2f915 commit 2b0fbe0
Showing 1 changed file with 4 additions and 1 deletion.
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
package com.sdercolin.vlabeler.ui.dialog.customization

import androidx.compose.material.SnackbarDuration
import androidx.compose.runtime.Composable
import androidx.compose.runtime.getValue
import androidx.compose.runtime.mutableStateListOf
import androidx.compose.runtime.mutableStateOf
import androidx.compose.runtime.setValue
import com.sdercolin.vlabeler.env.Log
import com.sdercolin.vlabeler.exception.CustomizableItemRemovingException
import com.sdercolin.vlabeler.ui.AppRecordStore
import com.sdercolin.vlabeler.ui.AppState
Expand Down Expand Up @@ -113,7 +115,8 @@ abstract class CustomizableItemManagerDialogState<T : CustomizableItem>(

private suspend fun addNewItem(configFile: File) {
val item = runCatching { importNewItem(configFile) }.getOrElse {
appState.showSnackbar(it.message.orEmpty())
Log.error(it)
appState.showSnackbar(it.message.orEmpty(), duration = SnackbarDuration.Indefinite)
return
}
newlyAddedItemNames.add(item)
Expand Down

0 comments on commit 2b0fbe0

Please sign in to comment.