mirror of
https://github.com/matrix-org/dendrite.git
synced 2025-12-11 17:03:10 -06:00
Using utils log reporting
This commit is contained in:
parent
86606e68eb
commit
eaa21e2a1d
|
|
@ -49,7 +49,10 @@ func GetProfile(
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
localpart := getLocalPart(userID)
|
localpart := getLocalPart(userID)
|
||||||
if profile, err := accountDB.GetProfileByLocalpart(localpart); err == nil {
|
profile, err := accountDB.GetProfileByLocalpart(localpart)
|
||||||
|
if err != nil {
|
||||||
|
return httputil.LogThenError(req, err)
|
||||||
|
}
|
||||||
res := profileResponse{
|
res := profileResponse{
|
||||||
AvatarURL: profile.AvatarURL,
|
AvatarURL: profile.AvatarURL,
|
||||||
DisplayName: profile.DisplayName,
|
DisplayName: profile.DisplayName,
|
||||||
|
|
@ -59,11 +62,6 @@ func GetProfile(
|
||||||
JSON: res,
|
JSON: res,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return util.JSONResponse{
|
|
||||||
Code: 500,
|
|
||||||
JSON: jsonerror.Unknown("Failed to load user profile"),
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// GetAvatarURL implements GET /profile/{userID}/avatar_url
|
// GetAvatarURL implements GET /profile/{userID}/avatar_url
|
||||||
func GetAvatarURL(
|
func GetAvatarURL(
|
||||||
|
|
@ -112,10 +110,7 @@ func SetAvatarURL(
|
||||||
|
|
||||||
localpart := getLocalPart(userID)
|
localpart := getLocalPart(userID)
|
||||||
if err := accountDB.SetAvatarURL(localpart, r.AvatarURL); err != nil {
|
if err := accountDB.SetAvatarURL(localpart, r.AvatarURL); err != nil {
|
||||||
return util.JSONResponse{
|
return httputil.LogThenError(req, err)
|
||||||
Code: 500,
|
|
||||||
JSON: jsonerror.Unknown("Failed to set avatar URL"),
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
return util.JSONResponse{
|
return util.JSONResponse{
|
||||||
Code: 200,
|
Code: 200,
|
||||||
|
|
@ -170,10 +165,7 @@ func SetDisplayName(
|
||||||
|
|
||||||
localpart := getLocalPart(userID)
|
localpart := getLocalPart(userID)
|
||||||
if err := accountDB.SetDisplayName(localpart, r.DisplayName); err != nil {
|
if err := accountDB.SetDisplayName(localpart, r.DisplayName); err != nil {
|
||||||
return util.JSONResponse{
|
return httputil.LogThenError(req, err)
|
||||||
Code: 500,
|
|
||||||
JSON: jsonerror.Unknown("Failed to set display name"),
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
return util.JSONResponse{
|
return util.JSONResponse{
|
||||||
Code: 200,
|
Code: 200,
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue