summaryrefslogtreecommitdiffstats
path: root/store
diff options
context:
space:
mode:
authorJoram Wilander <jwawilander@gmail.com>2018-01-24 08:50:11 -0500
committerGitHub <noreply@github.com>2018-01-24 08:50:11 -0500
commit3918ed6c589a19bd385a6e566f07dc14d7484c49 (patch)
treef4a827a00e50eab1d47a70a6a85d369c44c84940 /store
parentf2415b98f652bc695d3825e54ac832ee468c0a63 (diff)
downloadchat-3918ed6c589a19bd385a6e566f07dc14d7484c49.tar.gz
chat-3918ed6c589a19bd385a6e566f07dc14d7484c49.tar.bz2
chat-3918ed6c589a19bd385a6e566f07dc14d7484c49.zip
Add GET /emojis/name/{emoji_name} API endpoint (#8142)
Diffstat (limited to 'store')
-rw-r--r--store/sqlstore/emoji_store.go4
1 files changed, 4 insertions, 0 deletions
diff --git a/store/sqlstore/emoji_store.go b/store/sqlstore/emoji_store.go
index afd87b83d..971cafb6a 100644
--- a/store/sqlstore/emoji_store.go
+++ b/store/sqlstore/emoji_store.go
@@ -4,6 +4,7 @@
package sqlstore
import (
+ "database/sql"
"net/http"
"github.com/mattermost/mattermost-server/einterfaces"
@@ -118,6 +119,9 @@ func (es SqlEmojiStore) GetByName(name string) store.StoreChannel {
Name = :Name
AND DeleteAt = 0`, map[string]interface{}{"Name": name}); err != nil {
result.Err = model.NewAppError("SqlEmojiStore.GetByName", "store.sql_emoji.get_by_name.app_error", nil, "name="+name+", "+err.Error(), http.StatusInternalServerError)
+ if err == sql.ErrNoRows {
+ result.Err.StatusCode = http.StatusNotFound
+ }
} else {
result.Data = emoji
}