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

Fix no error message issue

This commit is contained in:
Haibin Liu 2015-09-28 07:42:11 +08:00
parent d70592fd14
commit 5c6eeae33a

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
} }