added logging to several places concerning futures

This commit is contained in:
Sheldan
2020-05-01 22:56:21 +02:00
parent f2ce402256
commit 70365ca556
9 changed files with 68 additions and 10 deletions

View File

@@ -41,7 +41,7 @@ public class MessageEmbedListener implements MessageReceivedListener {
Consumer<CachedMessage> cachedMessageConsumer = cachedMessage -> messageEmbedService.embedLink(cachedMessage, message.getTextChannel(), cause, message);
messageCache.getMessageFromCache(messageEmbedLink.getServerId(), messageEmbedLink.getChannelId(), messageEmbedLink.getMessageId()).thenAccept(cachedMessageConsumer)
.exceptionally(throwable -> {
log.error("Error when embedding link.", throwable);
log.error("Error when embedding link for message {}", message.getId(), throwable);
return null;
});
}

View File

@@ -101,7 +101,10 @@ public class MessageEmbedServiceBean implements MessageEmbedService {
messageCache.getMessageFromCache(messageEmbedLink.getServerId(), messageEmbedLink.getChannelId(), messageEmbedLink.getMessageId())
.thenAccept(cachedMessage ->
self.embedLink(cachedMessage, target, reason, embeddingMessage)
)
).exceptionally(throwable -> {
log.error("Message retrieval from cache failed for message {}.", messageEmbedLink.getMessageId(), throwable);
return null;
})
);
}
@@ -121,6 +124,10 @@ public class MessageEmbedServiceBean implements MessageEmbedService {
} catch (InterruptedException | ExecutionException e) {
log.error("Failed to post message embed.", e);
}
}).exceptionally(throwable -> {
log.error("Failed to send message for embedding the link for message {} in channel {} in server {}",
cachedMessage.getMessageId(), cachedMessage.getChannelId(), cachedMessage.getServerId(), throwable);
return null;
});
}

View File

@@ -87,6 +87,9 @@ public class StarboardServiceBean implements StarboardService {
} catch (InterruptedException | ExecutionException e) {
log.error("Failed to post messages.", e);
}
}) .exceptionally(throwable -> {
log.error("Failed to create starboard post for message {} in channel {} in server {}", message.getMessageId(), message.getChannelId(), message.getServerId(), throwable);
return null;
});
}
@@ -125,6 +128,9 @@ public class StarboardServiceBean implements StarboardService {
} catch (InterruptedException | ExecutionException e) {
log.error("Failed to post starboard post.", e);
}
}).exceptionally(throwable -> {
log.error("Failed to update starboard post {}.", post.getId(), throwable);
return null;
});
}

View File

@@ -71,6 +71,9 @@ public class SuggestionServiceBean implements SuggestionService {
} catch (InterruptedException | ExecutionException e) {
log.warn("Failed to post suggestion", e);
}
}) .exceptionally(throwable -> {
log.error("Failed to post suggestion {}", suggestion.getId(), throwable);
return null;
});
} else {
log.warn("Guild {} or member {} was not found when creating suggestion.", member.getGuild().getIdLong(), member.getIdLong());