From af2b60ab995648cdd9c8d444a8b22cfeaadb59f7 Mon Sep 17 00:00:00 2001 From: Marcus Fihlon Date: Sun, 31 Mar 2024 11:11:43 +0200 Subject: [PATCH] =?UTF-8?q?=F0=9F=94=8A=20add=20error=20logging=20to=20`Ma?= =?UTF-8?q?stodonAPI`=20closes=20#39?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../swiss/fihlon/apus/social/mastodon/MastodonAPI.java | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/main/java/swiss/fihlon/apus/social/mastodon/MastodonAPI.java b/src/main/java/swiss/fihlon/apus/social/mastodon/MastodonAPI.java index 609c5d2..a8b2f44 100644 --- a/src/main/java/swiss/fihlon/apus/social/mastodon/MastodonAPI.java +++ b/src/main/java/swiss/fihlon/apus/social/mastodon/MastodonAPI.java @@ -18,6 +18,8 @@ package swiss.fihlon.apus.social.mastodon; import org.jetbrains.annotations.NotNull; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import social.bigbone.MastodonClient; import social.bigbone.api.Pageable; import social.bigbone.api.entity.Account; @@ -36,6 +38,8 @@ public final class MastodonAPI { + private static final Logger LOGGER = LoggerFactory.getLogger(MastodonAPI.class); + private final String instance; public MastodonAPI(@NotNull final String instance) { @@ -52,9 +56,10 @@ public List getMessages(@NotNull final String hashtag) { .toList() .reversed(); } catch (final BigBoneRequestException e) { - // TODO + LOGGER.error("Unable to load statuses with hashtag '{}' from Mastodon instance '{}': {}", + hashtag, instance, e.getMessage()); + return List.of(); } - return List.of(); } private Message convertToMessage(@NotNull final Status status) {