Log sent timestamps when hitting message processing errors.

This commit is contained in:
Greyson Parrelli 2020-09-24 12:26:18 -04:00
parent d9c15621f6
commit 9cf7eec247
2 changed files with 14 additions and 14 deletions

View file

@ -172,7 +172,7 @@ public final class PushDecryptMessageJob extends BaseJob {
return jobs; return jobs;
} catch (ProtocolInvalidVersionException e) { } catch (ProtocolInvalidVersionException e) {
Log.w(TAG, e); Log.w(TAG, String.valueOf(envelope.getTimestamp()), e);
return Collections.singletonList(new PushProcessMessageJob(PushProcessMessageJob.MessageState.INVALID_VERSION, return Collections.singletonList(new PushProcessMessageJob(PushProcessMessageJob.MessageState.INVALID_VERSION,
toExceptionMetadata(e), toExceptionMetadata(e),
messageId, messageId,
@ -180,7 +180,7 @@ public final class PushDecryptMessageJob extends BaseJob {
envelope.getTimestamp())); envelope.getTimestamp()));
} catch (ProtocolInvalidMessageException | ProtocolInvalidKeyIdException | ProtocolInvalidKeyException | ProtocolUntrustedIdentityException e) { } catch (ProtocolInvalidMessageException | ProtocolInvalidKeyIdException | ProtocolInvalidKeyException | ProtocolUntrustedIdentityException e) {
Log.w(TAG, e); Log.w(TAG, String.valueOf(envelope.getTimestamp()), e);
return Collections.singletonList(new PushProcessMessageJob(PushProcessMessageJob.MessageState.CORRUPT_MESSAGE, return Collections.singletonList(new PushProcessMessageJob(PushProcessMessageJob.MessageState.CORRUPT_MESSAGE,
toExceptionMetadata(e), toExceptionMetadata(e),
messageId, messageId,
@ -188,7 +188,7 @@ public final class PushDecryptMessageJob extends BaseJob {
envelope.getTimestamp())); envelope.getTimestamp()));
} catch (ProtocolNoSessionException e) { } catch (ProtocolNoSessionException e) {
Log.w(TAG, e); Log.w(TAG, String.valueOf(envelope.getTimestamp()), e);
return Collections.singletonList(new PushProcessMessageJob(PushProcessMessageJob.MessageState.NO_SESSION, return Collections.singletonList(new PushProcessMessageJob(PushProcessMessageJob.MessageState.NO_SESSION,
toExceptionMetadata(e), toExceptionMetadata(e),
messageId, messageId,
@ -196,7 +196,7 @@ public final class PushDecryptMessageJob extends BaseJob {
envelope.getTimestamp())); envelope.getTimestamp()));
} catch (ProtocolLegacyMessageException e) { } catch (ProtocolLegacyMessageException e) {
Log.w(TAG, e); Log.w(TAG, String.valueOf(envelope.getTimestamp()), e);
return Collections.singletonList(new PushProcessMessageJob(PushProcessMessageJob.MessageState.LEGACY_MESSAGE, return Collections.singletonList(new PushProcessMessageJob(PushProcessMessageJob.MessageState.LEGACY_MESSAGE,
toExceptionMetadata(e), toExceptionMetadata(e),
messageId, messageId,
@ -204,7 +204,7 @@ public final class PushDecryptMessageJob extends BaseJob {
envelope.getTimestamp())); envelope.getTimestamp()));
} catch (ProtocolDuplicateMessageException e) { } catch (ProtocolDuplicateMessageException e) {
Log.w(TAG, e); Log.w(TAG, String.valueOf(envelope.getTimestamp()), e);
return Collections.singletonList(new PushProcessMessageJob(PushProcessMessageJob.MessageState.DUPLICATE_MESSAGE, return Collections.singletonList(new PushProcessMessageJob(PushProcessMessageJob.MessageState.DUPLICATE_MESSAGE,
toExceptionMetadata(e), toExceptionMetadata(e),
messageId, messageId,
@ -212,7 +212,7 @@ public final class PushDecryptMessageJob extends BaseJob {
envelope.getTimestamp())); envelope.getTimestamp()));
} catch (InvalidMetadataVersionException | InvalidMetadataMessageException e) { } catch (InvalidMetadataVersionException | InvalidMetadataMessageException e) {
Log.w(TAG, e); Log.w(TAG, String.valueOf(envelope.getTimestamp()), e);
return Collections.emptyList(); return Collections.emptyList();
} catch (SelfSendException e) { } catch (SelfSendException e) {
@ -220,7 +220,7 @@ public final class PushDecryptMessageJob extends BaseJob {
return Collections.emptyList(); return Collections.emptyList();
} catch (UnsupportedDataMessageException e) { } catch (UnsupportedDataMessageException e) {
Log.w(TAG, e); Log.w(TAG, String.valueOf(envelope.getTimestamp()), e);
return Collections.singletonList(new PushProcessMessageJob(PushProcessMessageJob.MessageState.UNSUPPORTED_DATA_MESSAGE, return Collections.singletonList(new PushProcessMessageJob(PushProcessMessageJob.MessageState.UNSUPPORTED_DATA_MESSAGE,
toExceptionMetadata(e), toExceptionMetadata(e),
messageId, messageId,

View file

@ -458,37 +458,37 @@ public final class PushProcessMessageJob extends BaseJob {
switch (messageState) { switch (messageState) {
case INVALID_VERSION: case INVALID_VERSION:
Log.w(TAG, "Handling invalid version"); Log.w(TAG, "Handling invalid version (" + timestamp + ")");
handleInvalidVersionMessage(e.sender, e.senderDevice, timestamp, smsMessageId); handleInvalidVersionMessage(e.sender, e.senderDevice, timestamp, smsMessageId);
break; break;
case CORRUPT_MESSAGE: case CORRUPT_MESSAGE:
Log.w(TAG, "Handling corrupt message"); Log.w(TAG, "Handling corrupt message (" + timestamp + ")");
handleCorruptMessage(e.sender, e.senderDevice, timestamp, smsMessageId); handleCorruptMessage(e.sender, e.senderDevice, timestamp, smsMessageId);
break; break;
case NO_SESSION: case NO_SESSION:
Log.w(TAG, "Handling no session"); Log.w(TAG, "Handling no session (" + timestamp + ")");
handleNoSessionMessage(e.sender, e.senderDevice, timestamp, smsMessageId); handleNoSessionMessage(e.sender, e.senderDevice, timestamp, smsMessageId);
break; break;
case LEGACY_MESSAGE: case LEGACY_MESSAGE:
Log.w(TAG, "Handling legacy message"); Log.w(TAG, "Handling legacy message (" + timestamp + ")");
handleLegacyMessage(e.sender, e.senderDevice, timestamp, smsMessageId); handleLegacyMessage(e.sender, e.senderDevice, timestamp, smsMessageId);
break; break;
case DUPLICATE_MESSAGE: case DUPLICATE_MESSAGE:
Log.w(TAG, "Handling duplicate message"); Log.w(TAG, "Handling duplicate message (" + timestamp + ")");
handleDuplicateMessage(e.sender, e.senderDevice, timestamp, smsMessageId); handleDuplicateMessage(e.sender, e.senderDevice, timestamp, smsMessageId);
break; break;
case UNSUPPORTED_DATA_MESSAGE: case UNSUPPORTED_DATA_MESSAGE:
Log.w(TAG, "Handling unsupported data message"); Log.w(TAG, "Handling unsupported data message (" + timestamp + ")");
handleUnsupportedDataMessage(e.sender, e.senderDevice, Optional.fromNullable(e.groupId), timestamp, smsMessageId); handleUnsupportedDataMessage(e.sender, e.senderDevice, Optional.fromNullable(e.groupId), timestamp, smsMessageId);
break; break;
default: default:
throw new AssertionError("Not handled " + messageState); throw new AssertionError("Not handled " + messageState + ". (" + timestamp + ")");
} }
} }