From 1fe4cdaf46c4fc1e600ce1dff0646ac53e3d265a Mon Sep 17 00:00:00 2001 From: tobi <31960611+tsmethurst@users.noreply.github.com> Date: Thu, 14 Mar 2024 17:57:54 +0100 Subject: [PATCH] [bugfix] Don't return 500 when searching for unpermitted status (#2753) --- internal/processing/search/get.go | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) diff --git a/internal/processing/search/get.go b/internal/processing/search/get.go index c0b011bdb..e4839a179 100644 --- a/internal/processing/search/get.go +++ b/internal/processing/search/get.go @@ -491,7 +491,14 @@ func (p *Processor) byURI( if err != nil { // Check for semi-expected error types. // On one of these, we can continue. - if !gtserror.IsUnretrievable(err) && !gtserror.IsWrongType(err) { + switch { + case gtserror.IsUnretrievable(err), + gtserror.IsWrongType(err): + log.Debugf(ctx, + "semi-expected error type looking up %s as account: %v", + uri, err, + ) + default: err = gtserror.Newf("error looking up %s as account: %w", uri, err) return gtserror.NewErrorInternalError(err) } @@ -509,7 +516,15 @@ func (p *Processor) byURI( if err != nil { // Check for semi-expected error types. // On one of these, we can continue. - if !gtserror.IsUnretrievable(err) && !gtserror.IsWrongType(err) { + switch { + case gtserror.IsUnretrievable(err), + gtserror.IsWrongType(err), + gtserror.NotPermitted(err): + log.Debugf(ctx, + "semi-expected error type looking up %s as status: %v", + uri, err, + ) + default: err = gtserror.Newf("error looking up %s as status: %w", uri, err) return gtserror.NewErrorInternalError(err) }