update for latest micro changes
Signed-off-by: Vasiliy Tolstov <v.tolstov@unistack.org>
This commit is contained in:
@@ -17,18 +17,18 @@ func (h *Handler) CommentCreate(ctx context.Context, req *pb.CommentCreateReq, r
|
||||
|
||||
err := req.Validate()
|
||||
if err != nil {
|
||||
logger.Error(ctx, err)
|
||||
logger.Error(ctx, "validation error", err)
|
||||
httpsrv.SetRspCode(ctx, http.StatusBadRequest)
|
||||
return httpsrv.SetError(NewValidationError(err))
|
||||
}
|
||||
|
||||
var com *models.Comment
|
||||
if com, err = h.store.CommentCreate(ctx, req); err != nil {
|
||||
logger.Error(ctx, err)
|
||||
if errors.Is(err, sql.ErrNoRows) {
|
||||
httpsrv.SetRspCode(ctx, http.StatusNotFound)
|
||||
return httpsrv.SetError(NewNotFoundError(err))
|
||||
}
|
||||
logger.Error(ctx, "comment create error", err)
|
||||
httpsrv.SetRspCode(ctx, http.StatusInternalServerError)
|
||||
return httpsrv.SetError(NewInternalError(err))
|
||||
}
|
||||
|
Reference in New Issue
Block a user