Skip to content

Commit 443666a

Browse files
committed
Add LocalDraftUploadStarter error handling
1 parent 3f384f1 commit 443666a

File tree

1 file changed

+11
-2
lines changed

1 file changed

+11
-2
lines changed

WordPress/src/main/java/org/wordpress/android/ui/uploads/LocalDraftUploadStarter.kt

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ import org.wordpress.android.fluxc.store.PostStore
1616
import org.wordpress.android.fluxc.store.SiteStore
1717
import org.wordpress.android.modules.BG_THREAD
1818
import org.wordpress.android.modules.IO_THREAD
19+
import org.wordpress.android.util.CrashLoggingUtils
1920
import org.wordpress.android.util.NetworkUtilsWrapper
2021
import org.wordpress.android.util.skip
2122
import org.wordpress.android.viewmodel.helpers.ConnectionStatus
@@ -82,14 +83,22 @@ class LocalDraftUploadStarter @Inject constructor(
8283

8384
private fun queueUploadFromAllSites() = launch {
8485
val sites = siteStore.sites
85-
checkConnectionAndUpload(sites = sites)
86+
try {
87+
checkConnectionAndUpload(sites = sites)
88+
} catch (e: Exception) {
89+
CrashLoggingUtils.log(e)
90+
}
8691
}
8792

8893
/**
8994
* Upload all local drafts from the given [site].
9095
*/
9196
fun queueUploadFromSite(site: SiteModel) = launch {
92-
checkConnectionAndUpload(sites = listOf(site))
97+
try {
98+
checkConnectionAndUpload(sites = listOf(site))
99+
} catch (e: Exception) {
100+
CrashLoggingUtils.log(e)
101+
}
93102
}
94103

95104
/**

0 commit comments

Comments
 (0)