diff options
Diffstat (limited to 'internal/api/util/errorhandling.go')
-rw-r--r-- | internal/api/util/errorhandling.go | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/internal/api/util/errorhandling.go b/internal/api/util/errorhandling.go index 848beff5b..d2b9171c8 100644 --- a/internal/api/util/errorhandling.go +++ b/internal/api/util/errorhandling.go @@ -184,3 +184,21 @@ func OAuthErrorHandler(c *gin.Context, errWithCode gtserror.WithCode) { "error_description": errWithCode.Safe(), }) } + +// NotFoundAfterMove returns code 404 to the caller and writes a helpful error message. +// Specifically used for accounts trying to access endpoints they cannot use while moving. +func NotFoundAfterMove(c *gin.Context) { + const errMsg = "your account has Moved or is currently Moving; you cannot use this endpoint" + JSON(c, http.StatusForbidden, map[string]string{ + "error": errMsg, + }) +} + +// ForbiddenAfterMove returns code 403 to the caller and writes a helpful error message. +// Specifically used for accounts trying to take actions on endpoints they cannot do while moving. +func ForbiddenAfterMove(c *gin.Context) { + const errMsg = "your account has Moved or is currently Moving; you cannot take create or update type actions" + JSON(c, http.StatusForbidden, map[string]string{ + "error": errMsg, + }) +} |