1
0
mirror of https://github.com/beego/bee.git synced 2024-11-22 15:10:54 +00:00

Merge pull request #132 from haibin/develop

Fix no error message issue
This commit is contained in:
astaxie 2015-10-11 18:01:13 +08:00
commit 581b80bc6c

View File

@ -323,7 +323,7 @@ func (o *ObjectController) Get() {
if objectId != "" { if objectId != "" {
ob, err := models.GetOne(objectId) ob, err := models.GetOne(objectId)
if err != nil { if err != nil {
o.Data["json"] = err o.Data["json"] = err.Error()
} else { } else {
o.Data["json"] = ob o.Data["json"] = ob
} }
@ -356,7 +356,7 @@ func (o *ObjectController) Put() {
err := models.Update(objectId, ob.Score) err := models.Update(objectId, ob.Score)
if err != nil { if err != nil {
o.Data["json"] = err o.Data["json"] = err.Error()
} else { } else {
o.Data["json"] = "update success!" o.Data["json"] = "update success!"
} }
@ -426,7 +426,7 @@ func (u *UserController) Get() {
if uid != "" { if uid != "" {
user, err := models.GetUser(uid) user, err := models.GetUser(uid)
if err != nil { if err != nil {
u.Data["json"] = err u.Data["json"] = err.Error()
} else { } else {
u.Data["json"] = user u.Data["json"] = user
} }
@ -448,7 +448,7 @@ func (u *UserController) Put() {
json.Unmarshal(u.Ctx.Input.RequestBody, &user) json.Unmarshal(u.Ctx.Input.RequestBody, &user)
uu, err := models.UpdateUser(uid, &user) uu, err := models.UpdateUser(uid, &user)
if err != nil { if err != nil {
u.Data["json"] = err u.Data["json"] = err.Error()
} else { } else {
u.Data["json"] = uu u.Data["json"] = uu
} }