Skip to content

Commit

Permalink
🔊 add error logging to MastodonAPI closes #39
Browse files Browse the repository at this point in the history
  • Loading branch information
McPringle committed Mar 31, 2024
1 parent db41eea commit af2b60a
Showing 1 changed file with 7 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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) {
Expand All @@ -52,9 +56,10 @@ public List<Message> 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) {
Expand Down

0 comments on commit af2b60a

Please sign in to comment.