Skip to content

Commit

Permalink
Replace TODO with Sentry.captureMessage()
Browse files Browse the repository at this point in the history
  • Loading branch information
LunarX committed Oct 21, 2024
1 parent 74cc6c5 commit cb926fd
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,10 @@ class NewTransferViewModel @Inject constructor(
val restoredFileData = transferFilesManager.getRestoredFileData(alreadyCopiedFiles)

if (alreadyCopiedFiles.size != restoredFileData.size) {
TODO() // TODO: Capture sentry message to handle the fact that restoring the already imported files failed
Sentry.withScope { scope ->
scope.level = SentryLevel.ERROR
Sentry.captureMessage("Failure of the restoration of the already imported files after a process kill")
}
}

filesMutationMutex.withLock {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,9 @@ class TransferFilesManager @Inject constructor(@ApplicationContext private val a

fun getRestoredFileData(files: Array<File>): List<FileUi> {
return files.mapNotNull { file ->
val fileSizeInBytes = runCatching { file.length() }.getOrNull() ?: return@mapNotNull null
val fileSizeInBytes = runCatching { file.length() }
.onFailure { Sentry.addBreadcrumb("Caught an exception while restoring imported files: $it") }
.getOrNull() ?: return@mapNotNull null

FileUi(
uid = file.name,
Expand Down

0 comments on commit cb926fd

Please sign in to comment.