mirror of
https://gitee.com/rainbond/Rainbond.git
synced 2024-12-01 03:07:51 +08:00
[REV] change http status to 400
This commit is contained in:
parent
e64a938e38
commit
048dcd5d65
@ -21,6 +21,7 @@ package controller
|
||||
import (
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"github.com/goodrain/rainbond/db/errors"
|
||||
"io/ioutil"
|
||||
"net/http"
|
||||
"net/url"
|
||||
@ -1099,6 +1100,10 @@ func (t *TenantStruct) AddEnv(w http.ResponseWriter, r *http.Request) {
|
||||
envD.Name = envM.Name
|
||||
envD.Scope = envM.Scope
|
||||
if err := handler.GetServiceManager().EnvAttr("add", &envD); err != nil {
|
||||
if err == errors.ErrRecordAlreadyExist {
|
||||
httputil.ReturnError(r, w, 400, fmt.Sprintf("%v", err))
|
||||
return
|
||||
}
|
||||
logrus.Errorf("Add env error, %v", err)
|
||||
httputil.ReturnError(r, w, 500, fmt.Sprintf("Add env error, %v", err))
|
||||
return
|
||||
|
Loading…
Reference in New Issue
Block a user