aboutsummaryrefslogtreecommitdiff
path: root/federationapi/routing/profile.go
diff options
context:
space:
mode:
authorTill Faelligen <2353100+S7evinK@users.noreply.github.com>2023-07-14 14:24:31 +0200
committerTill Faelligen <2353100+S7evinK@users.noreply.github.com>2023-07-14 14:24:31 +0200
commit33ff3095722d063673f7168dd63bb2aef8ca735d (patch)
tree757cef23a27f9859afb9a16ae2793045f24472ea /federationapi/routing/profile.go
parent6011ddc0a89a28409e3703b1e3e62fa249e04c97 (diff)
Don't HTTP500 if a profile does't exist
Diffstat (limited to 'federationapi/routing/profile.go')
-rw-r--r--federationapi/routing/profile.go8
1 files changed, 8 insertions, 0 deletions
diff --git a/federationapi/routing/profile.go b/federationapi/routing/profile.go
index e6a488ba..e8c7ff79 100644
--- a/federationapi/routing/profile.go
+++ b/federationapi/routing/profile.go
@@ -15,9 +15,11 @@
package routing
import (
+ "errors"
"fmt"
"net/http"
+ appserviceAPI "github.com/matrix-org/dendrite/appservice/api"
"github.com/matrix-org/dendrite/internal/eventutil"
"github.com/matrix-org/dendrite/setup/config"
userapi "github.com/matrix-org/dendrite/userapi/api"
@@ -52,6 +54,12 @@ func GetProfile(
profile, err := userAPI.QueryProfile(httpReq.Context(), userID)
if err != nil {
+ if errors.Is(err, appserviceAPI.ErrProfileNotExists) {
+ return util.JSONResponse{
+ Code: http.StatusNotFound,
+ JSON: spec.NotFound("The user does not exist or does not have a profile."),
+ }
+ }
util.GetLogger(httpReq.Context()).WithError(err).Error("userAPI.QueryProfile failed")
return util.JSONResponse{
Code: http.StatusInternalServerError,