diff options
Diffstat (limited to 'internal/federation/dereferencing/error.go')
| -rw-r--r-- | internal/federation/dereferencing/error.go | 66 | 
1 files changed, 0 insertions, 66 deletions
| diff --git a/internal/federation/dereferencing/error.go b/internal/federation/dereferencing/error.go index 769150cef..1b8d90653 100644 --- a/internal/federation/dereferencing/error.go +++ b/internal/federation/dereferencing/error.go @@ -19,25 +19,8 @@ package dereferencing  import (  	"fmt" -	"net/http" - -	"github.com/superseriousbusiness/gotosocial/internal/gtserror"  ) -// ErrDB denotes that a proper error has occurred when doing -// a database call, as opposed to a simple db.ErrNoEntries. -type ErrDB struct { -	wrapped error -} - -func (err *ErrDB) Error() string { -	return fmt.Sprintf("database error during dereferencing: %v", err.wrapped) -} - -func newErrDB(err error) error { -	return &ErrDB{wrapped: err} -} -  // ErrNotRetrievable denotes that an item could not be dereferenced  // with the given parameters.  type ErrNotRetrievable struct { @@ -51,52 +34,3 @@ func (err *ErrNotRetrievable) Error() string {  func NewErrNotRetrievable(err error) error {  	return &ErrNotRetrievable{wrapped: err}  } - -// ErrTransportError indicates that something unforeseen went wrong creating -// a transport, or while making an http call to a remote resource with a transport. -type ErrTransportError struct { -	wrapped error -} - -func (err *ErrTransportError) Error() string { -	return fmt.Sprintf("transport error: %v", err.wrapped) -} - -func newErrTransportError(err error) error { -	return &ErrTransportError{wrapped: err} -} - -// ErrOther denotes some other kind of weird error, perhaps from a malformed json -// or some other weird crapola. -type ErrOther struct { -	wrapped error -} - -func (err *ErrOther) Error() string { -	return fmt.Sprintf("unexpected error: %v", err.wrapped) -} - -func newErrOther(err error) error { -	return &ErrOther{wrapped: err} -} - -func wrapDerefError(derefErr error, fluff string) error { -	// Wrap with fluff. -	err := derefErr -	if fluff != "" { -		err = fmt.Errorf("%s: %w", fluff, derefErr) -	} - -	// Check for unretrievable HTTP status code errors. -	if code := gtserror.StatusCode(derefErr); // nocollapse -	code == http.StatusGone || code == http.StatusNotFound { -		return NewErrNotRetrievable(err) -	} - -	// Check for other untrievable errors. -	if gtserror.NotFound(derefErr) { -		return NewErrNotRetrievable(err) -	} - -	return err -} | 
