From: David ‘Bombe’ Roden Date: Sun, 3 Nov 2019 09:13:12 +0000 (+0100) Subject: 🎨 Catch and log exceptions in identity manager thread X-Git-Tag: v81^2~58 X-Git-Url: https://git.pterodactylus.net/?p=Sone.git;a=commitdiff_plain;h=b70917b1b2384646c4c7b6e202bbfc4de1769124 🎨 Catch and log exceptions in identity manager thread --- diff --git a/src/main/kotlin/net/pterodactylus/sone/freenet/wot/IdentityLoader.kt b/src/main/kotlin/net/pterodactylus/sone/freenet/wot/IdentityLoader.kt index 3a71772..f9019d0 100644 --- a/src/main/kotlin/net/pterodactylus/sone/freenet/wot/IdentityLoader.kt +++ b/src/main/kotlin/net/pterodactylus/sone/freenet/wot/IdentityLoader.kt @@ -48,12 +48,7 @@ class IdentityLoader @Inject constructor(private val webOfTrustConnector: WebOfT } else { logger.fine { "Loading trusted identities for $ownIdentity from WoT..." } time({ stopwatch, identities -> "Loaded ${identities.size} identities for ${ownIdentity.nickname} in ${stopwatch.elapsed(MILLISECONDS) / 1000.0}s." }) { - try { - webOfTrustConnector.loadTrustedIdentities(ownIdentity, context?.context) - } catch (e: Exception) { - logger.warning { "Caught $e on loading trusted identities for $ownIdentity."} - throw e - } + webOfTrustConnector.loadTrustedIdentities(ownIdentity, context?.context) } } } diff --git a/src/main/kotlin/net/pterodactylus/sone/freenet/wot/IdentityManagerImpl.kt b/src/main/kotlin/net/pterodactylus/sone/freenet/wot/IdentityManagerImpl.kt index 1e83cd7..cb7d0bd 100644 --- a/src/main/kotlin/net/pterodactylus/sone/freenet/wot/IdentityManagerImpl.kt +++ b/src/main/kotlin/net/pterodactylus/sone/freenet/wot/IdentityManagerImpl.kt @@ -69,6 +69,8 @@ class IdentityManagerImpl @Inject constructor( } } catch (wote1: WebOfTrustException) { logger.log(Level.WARNING, "WoT has disappeared!", wote1) + } catch (e: Exception) { + logger.log(Level.SEVERE, "Uncaught exception in IdentityManager thread!", e) } /* wait a minute before checking again. */