log error on header/avatar fetch fail

This commit is contained in:
tsmethurst 2022-02-08 12:37:58 +01:00
parent b42b0a667e
commit c4ece24654
2 changed files with 9 additions and 0 deletions

View file

@ -25,6 +25,7 @@
"fmt" "fmt"
"net/url" "net/url"
"github.com/sirupsen/logrus"
"github.com/spf13/viper" "github.com/spf13/viper"
"github.com/superseriousbusiness/activity/pub" "github.com/superseriousbusiness/activity/pub"
"github.com/superseriousbusiness/activity/streams" "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) avatar, err := c.db.GetAttachmentByID(ctx, a.AvatarMediaAttachmentID)
if err == nil { if err == nil {
a.AvatarMediaAttachment = avatar 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) header, err := c.db.GetAttachmentByID(ctx, a.HeaderMediaAttachmentID)
if err == nil { if err == nil {
a.HeaderMediaAttachment = header a.HeaderMediaAttachment = header
} else {
logrus.Errorf("AccountToAS: error getting Header with id %s: %s", a.HeaderMediaAttachmentID, err)
} }
} }

View file

@ -104,6 +104,8 @@ func (c *converter) AccountToAPIAccountPublic(ctx context.Context, a *gtsmodel.A
avi, err := c.db.GetAttachmentByID(ctx, a.AvatarMediaAttachmentID) avi, err := c.db.GetAttachmentByID(ctx, a.AvatarMediaAttachmentID)
if err == nil { if err == nil {
a.AvatarMediaAttachment = avi a.AvatarMediaAttachment = avi
} else {
logrus.Errorf("AccountToAPIAccountPublic: error getting Avatar with id %s: %s", a.AvatarMediaAttachmentID, err)
} }
} }
if a.AvatarMediaAttachment != nil { 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) avi, err := c.db.GetAttachmentByID(ctx, a.HeaderMediaAttachmentID)
if err == nil { if err == nil {
a.HeaderMediaAttachment = avi a.HeaderMediaAttachment = avi
} else {
logrus.Errorf("AccountToAPIAccountPublic: error getting Header with id %s: %s", a.HeaderMediaAttachmentID, err)
} }
} }
if a.HeaderMediaAttachment != nil { if a.HeaderMediaAttachment != nil {