summaryrefslogtreecommitdiff
path: root/internal/federation/dereferencing/thread.go
diff options
context:
space:
mode:
authorLibravatar kim <89579420+NyaaaWhatsUpDoc@users.noreply.github.com>2023-05-28 13:08:35 +0100
committerLibravatar GitHub <noreply@github.com>2023-05-28 14:08:35 +0200
commit5faeb4de2032e112ab49751eeeb906ac43826f3d (patch)
treeea94b86f27384954ff93aec864b13b83c7f46db0 /internal/federation/dereferencing/thread.go
parent[docs] Update + simplify roadmap, revise beta estimate (#1826) (diff)
downloadgotosocial-5faeb4de2032e112ab49751eeeb906ac43826f3d.tar.xz
[chore] tidy up media manager, add calling func to errors, build-script improvements (#1835)
* media manager tidy-up: de-interface and remove unused PostDataFunc Signed-off-by: kim <grufwub@gmail.com> * remove last traces of media.Manager being an interface Signed-off-by: kim <grufwub@gmail.com> * update error to provide caller, allow tuneable via build tags Signed-off-by: kim <grufwub@gmail.com> * remove kim-specific build script changes Signed-off-by: kim <grufwub@gmail.com> * fix merge conflicts Signed-off-by: kim <grufwub@gmail.com> * update build-script to support externally setting build variables Signed-off-by: kim <grufwub@gmail.com> --------- Signed-off-by: kim <grufwub@gmail.com>
Diffstat (limited to 'internal/federation/dereferencing/thread.go')
-rw-r--r--internal/federation/dereferencing/thread.go18
1 files changed, 9 insertions, 9 deletions
diff --git a/internal/federation/dereferencing/thread.go b/internal/federation/dereferencing/thread.go
index b516f837b..3b58b4eed 100644
--- a/internal/federation/dereferencing/thread.go
+++ b/internal/federation/dereferencing/thread.go
@@ -19,13 +19,13 @@ package dereferencing
import (
"context"
- "fmt"
"net/url"
"codeberg.org/gruf/go-kv"
"github.com/superseriousbusiness/activity/streams/vocab"
"github.com/superseriousbusiness/gotosocial/internal/ap"
"github.com/superseriousbusiness/gotosocial/internal/config"
+ "github.com/superseriousbusiness/gotosocial/internal/gtserror"
"github.com/superseriousbusiness/gotosocial/internal/gtsmodel"
"github.com/superseriousbusiness/gotosocial/internal/log"
"github.com/superseriousbusiness/gotosocial/internal/uris"
@@ -39,12 +39,12 @@ const maxIter = 1000
func (d *deref) dereferenceThread(ctx context.Context, username string, statusIRI *url.URL, status *gtsmodel.Status, statusable ap.Statusable) {
// Ensure that ancestors have been fully dereferenced
if err := d.dereferenceStatusAncestors(ctx, username, status); err != nil {
- log.Errorf(ctx, "error dereferencing status ancestors: %v", err)
+ log.Error(ctx, err) // log entry and error will include caller prefixes
}
// Ensure that descendants have been fully dereferenced
if err := d.dereferenceStatusDescendants(ctx, username, statusIRI, statusable); err != nil {
- log.Errorf(ctx, "error dereferencing status descendants: %v", err)
+ log.Error(ctx, err) // log entry and error will include caller prefixes
}
}
@@ -72,7 +72,7 @@ func (d *deref) dereferenceStatusAncestors(ctx context.Context, username string,
// Parse this status's replied IRI
replyIRI, err := url.Parse(status.InReplyToURI)
if err != nil {
- return fmt.Errorf("invalid status InReplyToURI %q: %w", status.InReplyToURI, err)
+ return gtserror.Newf("invalid status InReplyToURI %q: %w", status.InReplyToURI, err)
}
if replyIRI.Host == config.GetHost() {
@@ -81,13 +81,13 @@ func (d *deref) dereferenceStatusAncestors(ctx context.Context, username string,
// This is our status, extract ID from path
_, id, err := uris.ParseStatusesPath(replyIRI)
if err != nil {
- return fmt.Errorf("invalid local status IRI %q: %w", status.InReplyToURI, err)
+ return gtserror.Newf("invalid local status IRI %q: %w", status.InReplyToURI, err)
}
// Fetch this status from the database
localStatus, err := d.state.DB.GetStatusByID(ctx, id)
if err != nil {
- return fmt.Errorf("error fetching local status %q: %w", id, err)
+ return gtserror.Newf("error fetching local status %q: %w", id, err)
}
// Set the fetched status
@@ -102,7 +102,7 @@ func (d *deref) dereferenceStatusAncestors(ctx context.Context, username string,
replyIRI,
)
if err != nil {
- return fmt.Errorf("error fetching remote status %q: %w", status.InReplyToURI, err)
+ return gtserror.Newf("error fetching remote status %q: %w", status.InReplyToURI, err)
}
// Set the fetched status
@@ -110,7 +110,7 @@ func (d *deref) dereferenceStatusAncestors(ctx context.Context, username string,
}
}
- return fmt.Errorf("reached %d ancestor iterations for %q", maxIter, ogIRI)
+ return gtserror.Newf("reached %d ancestor iterations for %q", maxIter, ogIRI)
}
func (d *deref) dereferenceStatusDescendants(ctx context.Context, username string, statusIRI *url.URL, parent ap.Statusable) error {
@@ -312,5 +312,5 @@ stackLoop:
}
}
- return fmt.Errorf("reached %d descendant iterations for %q", maxIter, ogIRI.String())
+ return gtserror.Newf("reached %d descendant iterations for %q", maxIter, ogIRI.String())
}