Cleanup and little change on Throwable logging

This commit is contained in:
Benoit Marty 2020-02-05 11:39:23 +01:00
parent ed9c3379bf
commit a17ec14dd7
9 changed files with 13 additions and 7 deletions

View File

@ -1,5 +1,6 @@
<component name="ProjectCodeStyleConfiguration"> <component name="ProjectCodeStyleConfiguration">
<state> <state>
<option name="USE_PER_PROJECT_SETTINGS" value="true" /> <option name="USE_PER_PROJECT_SETTINGS" value="true" />
<option name="PREFERRED_PROJECT_CODE_STYLE" value="Default" />
</state> </state>
</component> </component>

View File

@ -59,7 +59,7 @@ class RoomMemberCountCondition(val iz: String) : Condition(Kind.room_member_coun
val (prefix, count) = match.destructured val (prefix, count) = match.destructured
return prefix to count.toInt() return prefix to count.toInt()
} catch (t: Throwable) { } catch (t: Throwable) {
Timber.d(t) Timber.e(t, "Unable to parse 'is' field")
} }
return null return null
} }

View File

@ -393,7 +393,7 @@ internal class DefaultCrossSigningService @Inject constructor(
return@forEach return@forEach
} catch (failure: Throwable) { } catch (failure: Throwable) {
// log // log
Timber.v(failure) Timber.w(failure, "Signature not valid?")
} }
} }
} }

View File

@ -414,7 +414,7 @@ internal class KeysBackup @Inject constructor(
olmDevice.verifySignature(fingerprint, authData.signalableJSONDictionary(), mySignature) olmDevice.verifySignature(fingerprint, authData.signalableJSONDictionary(), mySignature)
isSignatureValid = true isSignatureValid = true
} catch (e: OlmException) { } catch (e: OlmException) {
Timber.v(e, "getKeysBackupTrust: Bad signature from device ${device.deviceId}") Timber.w(e, "getKeysBackupTrust: Bad signature from device ${device.deviceId}")
} }
} }

View File

@ -66,6 +66,11 @@ internal abstract class SessionModule {
companion object { companion object {
internal fun getKeyAlias(userMd5: String) = "session_db_$userMd5" internal fun getKeyAlias(userMd5: String) = "session_db_$userMd5"
/**
* Rules:
* Annotate methods with @SessionScope only the @Provides annotated methods with computation and logic.
*/
@JvmStatic @JvmStatic
@Provides @Provides
fun providesHomeServerConnectionConfig(sessionParams: SessionParams): HomeServerConnectionConfig { fun providesHomeServerConnectionConfig(sessionParams: SessionParams): HomeServerConnectionConfig {

View File

@ -51,8 +51,8 @@ internal class RoomSummaryUpdater @Inject constructor(
private val roomAvatarResolver: RoomAvatarResolver, private val roomAvatarResolver: RoomAvatarResolver,
private val monarchy: Monarchy) { private val monarchy: Monarchy) {
// TODO: maybe allow user of SDK to give that list
companion object { companion object {
// TODO: maybe allow user of SDK to give that list
val PREVIEWABLE_TYPES = listOf( val PREVIEWABLE_TYPES = listOf(
// TODO filter message type (KEY_VERIFICATION_READY, etc.) // TODO filter message type (KEY_VERIFICATION_READY, etc.)
EventType.MESSAGE, EventType.MESSAGE,

View File

@ -110,7 +110,7 @@ internal class TimelineEventDecryptor(
eventEntity.setDecryptionResult(result) eventEntity.setDecryptionResult(result)
} }
} catch (e: MXCryptoError) { } catch (e: MXCryptoError) {
Timber.v(e, "Failed to decrypt event $eventId") Timber.w(e, "Failed to decrypt event $eventId")
if (e is MXCryptoError.Base && e.errorType == MXCryptoError.ErrorType.UNKNOWN_INBOUND_SESSION_ID) { if (e is MXCryptoError.Base && e.errorType == MXCryptoError.ErrorType.UNKNOWN_INBOUND_SESSION_ID) {
// Keep track of unknown sessions to automatically try to decrypt on new session // Keep track of unknown sessions to automatically try to decrypt on new session
realm.executeTransaction { realm.executeTransaction {

View File

@ -174,7 +174,7 @@ internal class SyncThread @Inject constructor(private val syncTask: SyncTask,
Timber.v("Cancelled") Timber.v("Cancelled")
} else if (failure.isTokenError()) { } else if (failure.isTokenError()) {
// No token or invalid token, stop the thread // No token or invalid token, stop the thread
Timber.w(failure) Timber.w(failure, "Token error")
isStarted = false isStarted = false
isTokenValid = false isTokenValid = false
} else { } else {

View File

@ -47,7 +47,7 @@ internal class TaskExecutor @Inject constructor(private val coroutineDispatchers
} }
resultOrFailure resultOrFailure
.onFailure { .onFailure {
Timber.d(it, "Task failed") Timber.e(it, "Task failed")
} }
.foldToCallback(task.callback) .foldToCallback(task.callback)
} }