From 51e03a33b78633293232008be9e8e270a7624bec Mon Sep 17 00:00:00 2001 From: aguestuser <aguestuser@riseup.net> Date: Fri, 21 Aug 2020 12:54:27 -0400 Subject: [PATCH] [hotfix] refine catch blocks for exceptions around common crashes * omit sending user's phone number from logs * always include channel phone number (to help correlate with crashes) * actually print stack trace via `logger.catching` --- src/main/java/io/finn/signald/Manager.java | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/src/main/java/io/finn/signald/Manager.java b/src/main/java/io/finn/signald/Manager.java index 8fcf614..0159a18 100644 --- a/src/main/java/io/finn/signald/Manager.java +++ b/src/main/java/io/finn/signald/Manager.java @@ -831,11 +831,10 @@ class Manager { accountData.axolotlStore.identityKeyStore.saveIdentity(e.getIdentifier(), e.getIdentityKey(), TrustLevel.UNTRUSTED); results.add(SendMessageResult.identityFailure(address, e.getIdentityKey())); } catch (NotFoundException e) { - logger.error("No key found: " + address.getIdentifier()); - logger.error(e.getMessage()); - logger.error(e.getStackTrace()); + logger.error("ERROR in Manager.sendMessage: no key found for user on channel: " + getUsername()); + logger.catching(e); } catch (UnregisteredUserException e) { - logger.error("User not registered: " + address.getIdentifier()); + logger.error("ERROR in Manager.sendMessage: unregistered user on channel: " + getUsername()); logger.error(e.getMessage()); logger.error(e.getStackTrace()); } finally { @@ -854,9 +853,8 @@ class Manager { try { accountData.save(); } catch(ConcurrentModificationException e) { - logger.error("Concurrent modification exception in account update for:" + accountData.username); - logger.error(e.getMessage()); - logger.error(e.getStackTrace()); + logger.error("ERROR in Manager.sendMessage: ConcurrentModificationException in account update for:" + getUsername()); + logger.catching(e); } accountUpdateTimer.observeDuration(); sendMessageTimer.observeDuration(); -- GitLab