fix(log): pass throwable to Log.w in Marmot catch blocks

Previously the catch-block warnings interpolated ${e.message} but
dropped the throwable, losing the stack trace and showing nothing for
exceptions whose message is null. Switch to the (tag, msg, throwable)
overload so the cause and stack trace are logged.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
davotoula
2026-05-04 10:52:39 +02:00
parent a22f63e42c
commit 31dee7fe38
2 changed files with 12 additions and 12 deletions
@@ -370,17 +370,17 @@ class MarmotManager(
try {
groupManager.clearAllState()
} catch (e: Exception) {
Log.w("MarmotManager") { "resetAllState(): groupManager.clearAllState failed: ${e.message}" }
Log.w("MarmotManager", "resetAllState(): groupManager.clearAllState failed", e)
}
try {
keyPackageRotationManager.clearAllState()
} catch (e: Exception) {
Log.w("MarmotManager") { "resetAllState(): keyPackageRotationManager.clearAllState failed: ${e.message}" }
Log.w("MarmotManager", "resetAllState(): keyPackageRotationManager.clearAllState failed", e)
}
try {
subscriptionManager.clear()
} catch (e: Exception) {
Log.w("MarmotManager") { "resetAllState(): subscriptionManager.clear failed: ${e.message}" }
Log.w("MarmotManager", "resetAllState(): subscriptionManager.clear failed", e)
}
}
@@ -405,7 +405,7 @@ class MarmotManager(
try {
messageStore?.delete(nostrGroupId)
} catch (e: Exception) {
Log.w("MarmotManager") { "Failed to delete persisted messages for $nostrGroupId: ${e.message}" }
Log.w("MarmotManager", "Failed to delete persisted messages for $nostrGroupId", e)
}
return outboundEvent
}
@@ -423,7 +423,7 @@ class MarmotManager(
try {
messageStore?.appendMessage(nostrGroupId, innerEventJson)
} catch (e: Exception) {
Log.w("MarmotManager") { "Failed to persist Marmot message for $nostrGroupId: ${e.message}" }
Log.w("MarmotManager", "Failed to persist Marmot message for $nostrGroupId", e)
}
}
@@ -435,7 +435,7 @@ class MarmotManager(
try {
messageStore?.loadMessages(nostrGroupId) ?: emptyList()
} catch (e: Exception) {
Log.w("MarmotManager") { "Failed to load persisted messages for $nostrGroupId: ${e.message}" }
Log.w("MarmotManager", "Failed to load persisted messages for $nostrGroupId", e)
emptyList()
}