mirror of
https://github.com/m1k1o/neko.git
synced 2024-07-24 14:40:50 +12:00
MemberAlreadyExists returns UnprocessableEntity.
This commit is contained in:
parent
e0f1857c51
commit
9deb5adee1
@ -1,6 +1,7 @@
|
||||
package members
|
||||
|
||||
import (
|
||||
"errors"
|
||||
"net/http"
|
||||
"strconv"
|
||||
|
||||
@ -82,7 +83,11 @@ func (h *MembersHandler) membersCreate(w http.ResponseWriter, r *http.Request) {
|
||||
|
||||
id, err := h.members.Insert(data.Username, data.Password, data.Profile)
|
||||
if err != nil {
|
||||
utils.HttpInternalServerError(w, err)
|
||||
if errors.Is(err, types.ErrMemberAlreadyExists) {
|
||||
utils.HttpUnprocessableEntity(w, err)
|
||||
} else {
|
||||
utils.HttpInternalServerError(w, err)
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user