Skip to content

Commit

Permalink
Merge pull request #1810 from Infomaniak/signatures-sentry
Browse files Browse the repository at this point in the history
Update Signatures Sentry
  • Loading branch information
KevinBoulongne committed Apr 16, 2024
2 parents b89e99f + a6668fe commit 140b578
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion app/src/main/java/com/infomaniak/mail/utils/SharedUtils.kt
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ import com.infomaniak.mail.utils.extensions.getFoldersIds
import com.infomaniak.mail.utils.extensions.getUids
import io.realm.kotlin.Realm
import io.sentry.Sentry
import io.sentry.SentryLevel
import org.jsoup.Jsoup
import javax.inject.Inject

Expand Down Expand Up @@ -149,6 +150,8 @@ class SharedUtils @Inject constructor(
}
}

private class SignatureException(message: String?, cause: Throwable) : Exception(message, cause)

companion object {

fun updateSignatures(mailbox: Mailbox, customRealm: Realm): Int? {
Expand All @@ -157,7 +160,11 @@ class SharedUtils @Inject constructor(
customRealm.writeBlocking { SignatureController.update(data!!.signatures, realm = this) }
null
} else {
Sentry.captureException(getApiException())
Sentry.withScope { scope ->
scope.level = SentryLevel.ERROR
val apiException = getApiException()
Sentry.captureException(SignatureException(apiException.message, apiException))
}
translatedError
}
}
Expand Down

0 comments on commit 140b578

Please sign in to comment.