make form available after failed commit sending
This commit is contained in:
@@ -101,7 +101,7 @@ func (s *private) createCommentCtrl(w http.ResponseWriter, r *http.Request) {
|
||||
|
||||
id, err := s.dataService.Create(comment)
|
||||
if err == service.ErrRestrictedWordsFound {
|
||||
rest.SendErrorJSON(w, r, http.StatusBadRequest, err, "invalid comment", rest.ErrCommentValidation)
|
||||
rest.SendErrorJSON(w, r, http.StatusBadRequest, err, "invalid comment", rest.ErrCommentRestrictWords)
|
||||
return
|
||||
}
|
||||
if err != nil {
|
||||
|
||||
@@ -19,25 +19,26 @@ import (
|
||||
|
||||
// All error codes for UI mapping and translation
|
||||
const (
|
||||
ErrInternal = 0 // any internal error
|
||||
ErrCommentNotFound = 1 // can't find comment
|
||||
ErrDecode = 2 // failed to unmarshal incoming request
|
||||
ErrNoAccess = 3 // rejected by auth
|
||||
ErrCommentValidation = 4 // validation failed
|
||||
ErrPostNotFound = 5 // can't find post
|
||||
ErrSiteNotFound = 6 // can't find site
|
||||
ErrUserBlocked = 7 // user blocked
|
||||
ErrReadOnly = 8 // write failed on read only
|
||||
ErrCommentRejected = 9 // general error on rejected comment change
|
||||
ErrCommentEditExpired = 10 // too late for edit
|
||||
ErrCommentEditChanged = 11 // parent comment cannot be changed
|
||||
ErrVoteRejected = 12 // general error on vote rejected
|
||||
ErrVoteSelf = 13 // vote for own comment
|
||||
ErrVoteDbl = 14 // already voted for the comment
|
||||
ErrVoteMax = 15 // too many votes for the comment
|
||||
ErrVoteMinScore = 16 // min score reached for the comment
|
||||
ErrActionRejected = 17 // general error for rejected actions
|
||||
ErrAssetNotFound = 18 // requested file not found
|
||||
ErrInternal = 0 // any internal error
|
||||
ErrCommentNotFound = 1 // can't find comment
|
||||
ErrDecode = 2 // failed to unmarshal incoming request
|
||||
ErrNoAccess = 3 // rejected by auth
|
||||
ErrCommentValidation = 4 // validation failed
|
||||
ErrPostNotFound = 5 // can't find post
|
||||
ErrSiteNotFound = 6 // can't find site
|
||||
ErrUserBlocked = 7 // user blocked
|
||||
ErrReadOnly = 8 // write failed on read only
|
||||
ErrCommentRejected = 9 // general error on rejected comment change
|
||||
ErrCommentEditExpired = 10 // too late for edit
|
||||
ErrCommentEditChanged = 11 // parent comment cannot be changed
|
||||
ErrVoteRejected = 12 // general error on vote rejected
|
||||
ErrVoteSelf = 13 // vote for own comment
|
||||
ErrVoteDbl = 14 // already voted for the comment
|
||||
ErrVoteMax = 15 // too many votes for the comment
|
||||
ErrVoteMinScore = 16 // min score reached for the comment
|
||||
ErrActionRejected = 17 // general error for rejected actions
|
||||
ErrAssetNotFound = 18 // requested file not found
|
||||
ErrCommentRestrictWords = 19 // restricted words in a comment
|
||||
)
|
||||
|
||||
// errTmplData store data for error message
|
||||
|
||||
Reference in New Issue
Block a user