From c4ece24654e195dbff06c1d7363c5fe92e1fd4c4 Mon Sep 17 00:00:00 2001 From: tsmethurst Date: Tue, 8 Feb 2022 12:37:58 +0100 Subject: [PATCH] log error on header/avatar fetch fail --- internal/typeutils/internaltoas.go | 5 +++++ internal/typeutils/internaltofrontend.go | 4 ++++ 2 files changed, 9 insertions(+) diff --git a/internal/typeutils/internaltoas.go b/internal/typeutils/internaltoas.go index a22b926d6..f154398ce 100644 --- a/internal/typeutils/internaltoas.go +++ b/internal/typeutils/internaltoas.go @@ -25,6 +25,7 @@ import ( "fmt" "net/url" + "github.com/sirupsen/logrus" "github.com/spf13/viper" "github.com/superseriousbusiness/activity/pub" "github.com/superseriousbusiness/activity/streams" @@ -218,6 +219,8 @@ func (c *converter) AccountToAS(ctx context.Context, a *gtsmodel.Account) (vocab avatar, err := c.db.GetAttachmentByID(ctx, a.AvatarMediaAttachmentID) if err == nil { a.AvatarMediaAttachment = avatar + } else { + logrus.Errorf("AccountToAS: error getting Avatar with id %s: %s", a.AvatarMediaAttachmentID, err) } } @@ -250,6 +253,8 @@ func (c *converter) AccountToAS(ctx context.Context, a *gtsmodel.Account) (vocab header, err := c.db.GetAttachmentByID(ctx, a.HeaderMediaAttachmentID) if err == nil { a.HeaderMediaAttachment = header + } else { + logrus.Errorf("AccountToAS: error getting Header with id %s: %s", a.HeaderMediaAttachmentID, err) } } diff --git a/internal/typeutils/internaltofrontend.go b/internal/typeutils/internaltofrontend.go index 989bf4a1e..39a2861fb 100644 --- a/internal/typeutils/internaltofrontend.go +++ b/internal/typeutils/internaltofrontend.go @@ -104,6 +104,8 @@ func (c *converter) AccountToAPIAccountPublic(ctx context.Context, a *gtsmodel.A avi, err := c.db.GetAttachmentByID(ctx, a.AvatarMediaAttachmentID) if err == nil { a.AvatarMediaAttachment = avi + } else { + logrus.Errorf("AccountToAPIAccountPublic: error getting Avatar with id %s: %s", a.AvatarMediaAttachmentID, err) } } if a.AvatarMediaAttachment != nil { @@ -120,6 +122,8 @@ func (c *converter) AccountToAPIAccountPublic(ctx context.Context, a *gtsmodel.A avi, err := c.db.GetAttachmentByID(ctx, a.HeaderMediaAttachmentID) if err == nil { a.HeaderMediaAttachment = avi + } else { + logrus.Errorf("AccountToAPIAccountPublic: error getting Header with id %s: %s", a.HeaderMediaAttachmentID, err) } } if a.HeaderMediaAttachment != nil {