Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove useless sentry #2034

Merged
merged 3 commits into from
Sep 9, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -301,7 +301,7 @@ class ThreadController @Inject constructor(

if (apiResponse.isSuccess()) return@runCatching apiResponse.data

SentryLog.e(TAG, "Could not fetch SwissTransfer container")
SentryLog.i(TAG, "Could not fetch SwissTransfer container")
return@runCatching null
}.getOrNull()

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -772,18 +772,13 @@ class NewMessageViewModel @Inject constructor(
if (recipient.isDisplayedAsExternal) appContext.trackExternalEvent("deleteRecipient")
}

fun deleteAttachment(position: Int) {
runCatching {
val attachments = attachmentsLiveData.valueOrEmpty().toMutableList()
val attachment = attachments[position]
attachment.getUploadLocalFile()?.delete()
LocalStorageUtils.deleteAttachmentUploadDir(appContext, draftLocalUuid!!, attachment.localUuid)
attachments.removeAt(position)
attachmentsLiveData.value = attachments
}.onFailure { exception ->
// TODO: If we don't see this Sentry after mid-2024, we can remove it.
SentryLog.e(TAG, " Attachment $position doesn't exist", exception)
}
fun deleteAttachment(position: Int) = runCatching {
val attachments = attachmentsLiveData.valueOrEmpty().toMutableList()
val attachment = attachments[position]
attachment.getUploadLocalFile()?.delete()
LocalStorageUtils.deleteAttachmentUploadDir(appContext, draftLocalUuid!!, attachment.localUuid)
attachments.removeAt(position)
attachmentsLiveData.value = attachments
}

fun updateIsSendingAllowed(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -167,9 +167,11 @@ object AttachmentExtensions {
if (apiResponse.isSuccess() && apiResponse.data != null) {
updateLocalAttachment(draftLocalUuid, apiResponse.data!!, draftController, realm)
} else {
SentryLog.e(
val baseMessage = "Upload failed for attachment $localUuid"
val errorMessage = "error : ${apiResponse.translatedError}"
SentryLog.i(
tag = ATTACHMENT_TAG,
msg = "Upload failed for attachment $localUuid - error : ${apiResponse.translatedError} - data : ${apiResponse.data}",
msg = "$baseMessage - $errorMessage - data : ${apiResponse.data}",
throwable = apiResponse.getApiException(),
)

Expand Down
Loading