summaryrefslogtreecommitdiff
path: root/internal/gtserror/error.go
diff options
context:
space:
mode:
authorLibravatar tobi <31960611+tsmethurst@users.noreply.github.com>2024-01-22 15:38:45 +0100
committerLibravatar GitHub <noreply@github.com>2024-01-22 14:38:45 +0000
commitd9729e7d28bd64a707443a8a7a6b0e4383b14caf (patch)
treea7c9ab3fe8fe3b62b84b025dfc1fbf2f3b4af2b9 /internal/gtserror/error.go
parent[chore]: Bump codeberg.org/gruf/go-mutexes from 1.3.1 to 1.4.0 (#2562) (diff)
downloadgotosocial-d9729e7d28bd64a707443a8a7a6b0e4383b14caf.tar.xz
[bugfix] Don't return Internal Server Error when searching for URIs that don't return AP JSON (#2550)
* [bugfix] Don't return Internal Server Error when searching for URIs that don't return AP JSON * don't pass map pointer
Diffstat (limited to 'internal/gtserror/error.go')
-rw-r--r--internal/gtserror/error.go12
1 files changed, 9 insertions, 3 deletions
diff --git a/internal/gtserror/error.go b/internal/gtserror/error.go
index 8338d30a4..9fd9812dc 100644
--- a/internal/gtserror/error.go
+++ b/internal/gtserror/error.go
@@ -55,9 +55,15 @@ func SetUnretrievable(err error) error {
return errors.WithValue(err, unrtrvableKey, struct{}{})
}
-// IsWrongType checks error for a stored "wrong type" flag. Wrong type
-// indicates that an ActivityPub URI returned a type we weren't expecting:
-// Statusable instead of Accountable, or vice versa, for example.
+// IsWrongType checks error for a stored "wrong type" flag.
+// Wrong type indicates that an ActivityPub URI returned a
+// type we weren't expecting. For example:
+//
+// - HTML instead of JSON.
+// - Normal JSON instead of ActivityPub JSON.
+// - Statusable instead of Accountable.
+// - Accountable instead of Statusable.
+// - etc.
func IsWrongType(err error) bool {
_, ok := errors.Value(err, wrongTypeKey).(struct{})
return ok