summaryrefslogtreecommitdiff
path: root/internal/api/client/admin/emojicreate.go
diff options
context:
space:
mode:
authorLibravatar tsmethurst <tobi.smethurst@protonmail.com>2022-01-15 17:36:15 +0100
committerLibravatar tsmethurst <tobi.smethurst@protonmail.com>2022-01-15 17:36:15 +0100
commit6bf39d0fc1286bdf2f4760adab52c6eff234d01d (patch)
treee4916598a7a14eab4336909c5fec1de6ed8ad0d4 /internal/api/client/admin/emojicreate.go
parentstart fixing up emoji processing code (diff)
downloadgotosocial-6bf39d0fc1286bdf2f4760adab52c6eff234d01d.tar.xz
emoji code passing muster
Diffstat (limited to 'internal/api/client/admin/emojicreate.go')
-rw-r--r--internal/api/client/admin/emojicreate.go10
1 files changed, 6 insertions, 4 deletions
diff --git a/internal/api/client/admin/emojicreate.go b/internal/api/client/admin/emojicreate.go
index de7a2979a..ef42d0a13 100644
--- a/internal/api/client/admin/emojicreate.go
+++ b/internal/api/client/admin/emojicreate.go
@@ -73,6 +73,8 @@ import (
// description: forbidden
// '400':
// description: bad request
+// '409':
+// description: conflict -- domain/shortcode combo for emoji already exists
func (m *Module) EmojiCreatePOSTHandler(c *gin.Context) {
l := logrus.WithFields(logrus.Fields{
"func": "emojiCreatePOSTHandler",
@@ -116,10 +118,10 @@ func (m *Module) EmojiCreatePOSTHandler(c *gin.Context) {
return
}
- apiEmoji, err := m.processor.AdminEmojiCreate(c.Request.Context(), authed, form)
- if err != nil {
- l.Debugf("error creating emoji: %s", err)
- c.JSON(http.StatusBadRequest, gin.H{"error": err.Error()})
+ apiEmoji, errWithCode := m.processor.AdminEmojiCreate(c.Request.Context(), authed, form)
+ if errWithCode != nil {
+ l.Debugf("error creating emoji: %s", errWithCode.Error())
+ c.JSON(errWithCode.Code(), gin.H{"error": errWithCode.Safe()})
return
}