Browse Source

Log all Scan errors

Vova Tkach 5 years ago
parent
commit
afb155ddf7

+ 4 - 4
engine/fetdata/blog.go

@@ -161,7 +161,7 @@ func (this *Blog) load() *Blog {
 			defer rows.Close()
 			for rows.Next() {
 				var cat_id string
-				if err := rows.Scan(&cat_id); err == nil {
+				if err := rows.Scan(&cat_id); this.wrap.LogCpError(err) == nil {
 					cat_ids = append(cat_ids, cat_id)
 				}
 			}
@@ -282,7 +282,7 @@ func (this *Blog) load() *Blog {
 		`
 	}
 
-	if err := this.wrap.DB.QueryRow(sql_nums).Scan(&this.postsCount); err == nil {
+	if err := this.wrap.DB.QueryRow(sql_nums).Scan(&this.postsCount); this.wrap.LogCpError(err) == nil {
 		if this.category == nil {
 			this.postsPerPage = (*this.wrap.Config).Blog.Pagination.Index
 		} else {
@@ -321,7 +321,7 @@ func (this *Blog) load() *Blog {
 					&ro.A_rgt,
 					&ro.A_depth,
 					&ro.A_parent,
-				); err == nil {
+				); this.wrap.LogCpError(err) == nil {
 					this.posts = append(this.posts, &BlogPost{
 						wrap:     this.wrap,
 						object:   &rp,
@@ -498,7 +498,7 @@ func (this *Blog) preload_cats() {
 					&row.A_rgt,
 					&row.A_depth,
 					&row.A_parent,
-				); err == nil {
+				); this.wrap.LogCpError(err) == nil {
 					this.bufferCats[row.A_id] = &row
 					if _, ok := this.bufferCats[row.A_parent]; ok {
 						this.bufferCats[row.A_parent].A_childs = true

+ 2 - 2
engine/fetdata/blog_category.go

@@ -95,7 +95,7 @@ func (this *BlogCategory) load(cache *map[int]*utils.MySql_blog_category) *BlogC
 				&row.A_rgt,
 				&row.A_depth,
 				&row.A_parent,
-			); err == nil {
+			); this.wrap.LogCpError(err) == nil {
 				this.bufferCats[row.A_id] = &row
 				if _, ok := this.bufferCats[row.A_parent]; ok {
 					this.bufferCats[row.A_parent].A_childs = true
@@ -182,7 +182,7 @@ func (this *BlogCategory) loadById(id int) {
 		&this.object.A_rgt,
 		&this.object.A_depth,
 		&this.object.A_parent,
-	); err != nil {
+	); this.wrap.LogCpError(err) != nil {
 		return
 	}
 }

+ 5 - 5
engine/fetdata/shop.go

@@ -172,7 +172,7 @@ func (this *Shop) load() *Shop {
 			defer rows.Close()
 			for rows.Next() {
 				var cat_id string
-				if err := rows.Scan(&cat_id); err == nil {
+				if err := rows.Scan(&cat_id); this.wrap.LogCpError(err) == nil {
 					cat_ids = append(cat_ids, cat_id)
 				}
 			}
@@ -307,7 +307,7 @@ func (this *Shop) load() *Shop {
 
 	product_ids := []string{}
 
-	if err := this.wrap.DB.QueryRow(sql_nums).Scan(&this.productsCount); err == nil {
+	if err := this.wrap.DB.QueryRow(sql_nums).Scan(&this.productsCount); this.wrap.LogCpError(err) == nil {
 		if this.category == nil {
 			this.productsPerPage = (*this.wrap.Config).Shop.Pagination.Index
 		} else {
@@ -356,7 +356,7 @@ func (this *Shop) load() *Shop {
 					&ro.A_rgt,
 					&ro.A_depth,
 					&ro.A_parent,
-				); err == nil {
+				); this.wrap.LogCpError(err) == nil {
 					product_ids = append(product_ids, utils.IntToStr(rp.A_id))
 					this.products = append(this.products, &ShopProduct{
 						wrap:     this.wrap,
@@ -391,7 +391,7 @@ func (this *Shop) load() *Shop {
 				if err := rows.Scan(
 					&img.A_product_id,
 					&img.A_filename,
-				); err == nil {
+				); this.wrap.LogCpError(err) == nil {
 					product_images[img.A_product_id] = append(product_images[img.A_product_id], &ShopProductImage{wrap: this.wrap, object: &img})
 				}
 			}
@@ -568,7 +568,7 @@ func (this *Shop) preload_cats() {
 					&row.A_rgt,
 					&row.A_depth,
 					&row.A_parent,
-				); err == nil {
+				); this.wrap.LogCpError(err) == nil {
 					this.bufferCats[row.A_id] = &row
 					if _, ok := this.bufferCats[row.A_parent]; ok {
 						this.bufferCats[row.A_parent].A_childs = true

+ 2 - 2
engine/fetdata/shop_category.go

@@ -95,7 +95,7 @@ func (this *ShopCategory) load(cache *map[int]*utils.MySql_shop_category) *ShopC
 				&row.A_rgt,
 				&row.A_depth,
 				&row.A_parent,
-			); err == nil {
+			); this.wrap.LogCpError(err) == nil {
 				this.bufferCats[row.A_id] = &row
 				if _, ok := this.bufferCats[row.A_parent]; ok {
 					this.bufferCats[row.A_parent].A_childs = true
@@ -182,7 +182,7 @@ func (this *ShopCategory) loadById(id int) {
 		&this.object.A_rgt,
 		&this.object.A_depth,
 		&this.object.A_parent,
-	); err != nil {
+	); this.wrap.LogCpError(err) != nil {
 		return
 	}
 }

+ 1 - 1
engine/fetdata/shop_currency.go

@@ -41,7 +41,7 @@ func (this *ShopCurrency) loadById(id int) {
 		&this.object.A_coefficient,
 		&this.object.A_code,
 		&this.object.A_symbol,
-	); err != nil {
+	); this.wrap.LogCpError(err) != nil {
 		return
 	}
 }

+ 2 - 2
engine/fetdata/shop_product.go

@@ -44,7 +44,7 @@ func (this *ShopProduct) load() *ShopProduct {
 			if err := rows.Scan(
 				&img.A_product_id,
 				&img.A_filename,
-			); err == nil {
+			); this.wrap.LogCpError(err) == nil {
 				this.images = append(this.images, &ShopProductImage{wrap: this.wrap, object: &img})
 			}
 		}
@@ -78,7 +78,7 @@ func (this *ShopProduct) load() *ShopProduct {
 		}
 		for rows.Next() {
 			err = rows.Scan(scan...)
-			if err == nil {
+			if this.wrap.LogCpError(err) == nil {
 				if !utils.InArrayInt(filter_ids, utils.StrToInt(string(values[0]))) {
 					filter_ids = append(filter_ids, utils.StrToInt(string(values[0])))
 				}

+ 1 - 1
engine/fetdata/user.go

@@ -43,7 +43,7 @@ func (this *User) loadById(id int) {
 		&this.object.A_email,
 		&this.object.A_admin,
 		&this.object.A_active,
-	); err != nil {
+	); this.wrap.LogCpError(err) != nil {
 		return
 	}
 }

+ 1 - 1
engine/wrapper/wrapper.go

@@ -175,7 +175,7 @@ func (this *Wrapper) LoadSessionUser() bool {
 		&user.A_admin,
 		&user.A_active,
 	)
-	if err != nil {
+	if this.LogCpError(err) != nil {
 		return false
 	}
 	if user.A_id != this.S.GetInt("UserId", 0) {

+ 5 - 3
modules/module_blog.go

@@ -121,6 +121,7 @@ func (this *Modules) RegisterModule_Blog() *Module {
 
 			if err != nil && err != wrapper.ErrNoRows {
 				// System error 500
+				wrap.LogCpError(err)
 				utils.SystemErrorPageEngine(wrap.W, err)
 				return
 			} else if err == wrapper.ErrNoRows {
@@ -187,6 +188,7 @@ func (this *Modules) RegisterModule_Blog() *Module {
 
 			if err != nil && err != wrapper.ErrNoRows {
 				// System error 500
+				wrap.LogCpError(err)
 				utils.SystemErrorPageEngine(wrap.W, err)
 				return
 			} else if err == wrapper.ErrNoRows {
@@ -438,7 +440,7 @@ func (this *Modules) RegisterModule_Blog() *Module {
 					&data.A_content,
 					&data.A_active,
 				)
-				if err != nil {
+				if wrap.LogCpError(err) != nil {
 					return "", "", ""
 				}
 			}
@@ -456,7 +458,7 @@ func (this *Modules) RegisterModule_Blog() *Module {
 					}
 					for rows.Next() {
 						err = rows.Scan(scan...)
-						if err == nil {
+						if wrap.LogCpError(err) == nil {
 							selids = append(selids, int(values[0]))
 						}
 					}
@@ -624,7 +626,7 @@ func (this *Modules) RegisterModule_Blog() *Module {
 					&data.A_lft,
 					&data.A_rgt,
 				)
-				if err != nil {
+				if wrap.LogCpError(err) != nil {
 					return "", "", ""
 				}
 			}

+ 2 - 2
modules/module_blog_act_modify.go

@@ -109,7 +109,7 @@ func (this *Modules) RegisterAction_BlogModify() *Action {
 					).Scan(
 						&catsCount,
 					)
-					if err != nil {
+					if wrap.LogCpError(err) != nil {
 						return err
 					}
 					if len(catids) != catsCount {
@@ -185,7 +185,7 @@ func (this *Modules) RegisterAction_BlogModify() *Action {
 					).Scan(
 						&catsCount,
 					)
-					if err != nil {
+					if wrap.LogCpError(err) != nil {
 						return err
 					}
 					if len(catids) != catsCount {

+ 2 - 2
modules/module_blog_categories.go

@@ -40,7 +40,7 @@ func (this *Modules) blog_GetCategorySelectOptions(wrap *wrapper.Wrapper, id int
 		parentIdStr := utils.IntToStr(parentId)
 		for rows.Next() {
 			err = rows.Scan(scan...)
-			if err == nil {
+			if wrap.LogCpError(err) == nil {
 				disabled := ""
 				if string(values[0]) == idStr {
 					disabled = " disabled"
@@ -84,7 +84,7 @@ func (this *Modules) blog_GetCategoryParentId(wrap *wrapper.Wrapper, id int) int
 	).Scan(
 		&parentId,
 	)
-	if err != nil {
+	if wrap.LogCpError(err) != nil {
 		return 0
 	}
 	return parentId

+ 4 - 4
modules/module_blog_categories_act_modify.go

@@ -76,13 +76,13 @@ func (this *Modules) blog_ActionCategoryUpdate(wrap *wrapper.Wrapper, pf_id, pf_
 
 		var parentL int
 		var parentR int
-		if err := tx.QueryRow(`SELECT lft, rgt FROM blog_cats WHERE id = ?;`, utils.StrToInt(pf_parent)).Scan(&parentL, &parentR); err != nil {
+		if err := tx.QueryRow(`SELECT lft, rgt FROM blog_cats WHERE id = ?;`, utils.StrToInt(pf_parent)).Scan(&parentL, &parentR); wrap.LogCpError(err) != nil {
 			return err
 		}
 
 		var targetL int
 		var targetR int
-		if err := tx.QueryRow(`SELECT lft, rgt FROM blog_cats WHERE id = ?;`, utils.StrToInt(pf_id)).Scan(&targetL, &targetR); err != nil {
+		if err := tx.QueryRow(`SELECT lft, rgt FROM blog_cats WHERE id = ?;`, utils.StrToInt(pf_id)).Scan(&targetL, &targetR); wrap.LogCpError(err) != nil {
 			return err
 		}
 
@@ -100,7 +100,7 @@ func (this *Modules) blog_ActionCategoryUpdate(wrap *wrapper.Wrapper, pf_id, pf_
 				var row_id int
 				var row_lft int
 				var row_rgt int
-				if err := rows.Scan(&row_id, &row_lft, &row_rgt); err == nil {
+				if err := rows.Scan(&row_id, &row_lft, &row_rgt); wrap.LogCpError(err) == nil {
 					rows_id = append(rows_id, row_id)
 					rows_lft = append(rows_lft, row_lft)
 					rows_rgt = append(rows_rgt, row_rgt)
@@ -210,7 +210,7 @@ func (this *Modules) RegisterAction_BlogCategoriesModify() *Action {
 				LIMIT 1;`,
 				utils.StrToInt(pf_parent),
 			).Scan(&parentId)
-			if err != nil {
+			if wrap.LogCpError(err) != nil {
 				wrap.MsgError(err.Error())
 				return
 			}

+ 2 - 1
modules/module_index.go

@@ -74,6 +74,7 @@ func (this *Modules) RegisterModule_Index() *Module {
 		)
 		if err != nil && err != wrapper.ErrNoRows {
 			// System error 500
+			wrap.LogCpError(err)
 			utils.SystemErrorPageEngine(wrap.W, err)
 			return
 		} else if err == wrapper.ErrNoRows {
@@ -224,7 +225,7 @@ func (this *Modules) RegisterModule_Index() *Module {
 					&data.A_meta_description,
 					&data.A_active,
 				)
-				if err != nil {
+				if wrap.LogCpError(err) != nil {
 					return "", "", ""
 				}
 			}

+ 1 - 1
modules/module_index_act_first_user.go

@@ -41,7 +41,7 @@ func (this *Modules) RegisterAction_IndexFirstUser() *Action {
 		).Scan(
 			&count,
 		)
-		if err != nil {
+		if wrap.LogCpError(err) != nil {
 			wrap.MsgError(err.Error())
 			return
 		}

+ 1 - 0
modules/module_index_act_signin.go

@@ -53,6 +53,7 @@ func (this *Modules) RegisterAction_IndexUserSignIn() *Action {
 		)
 
 		if err != nil && err != sqlw.ErrNoRows {
+			wrap.LogCpError(err)
 			wrap.MsgError(err.Error())
 			return
 		}

+ 29 - 24
modules/module_shop.go

@@ -36,7 +36,7 @@ func (this *Modules) shop_GetCurrencySelectOptions(wrap *wrapper.Wrapper, id int
 		idStr := utils.IntToStr(id)
 		for rows.Next() {
 			err = rows.Scan(scan...)
-			if err == nil {
+			if wrap.LogCpError(err) == nil {
 				selected := ""
 				if string(values[0]) == idStr {
 					selected = " selected"
@@ -96,7 +96,7 @@ func (this *Modules) shop_GetProductValuesInputs(wrap *wrapper.Wrapper, product_
 		}
 		for rows.Next() {
 			err = rows.Scan(scan...)
-			if err == nil {
+			if wrap.LogCpError(err) == nil {
 				filter_id := utils.StrToInt(string(values[0]))
 				if !utils.InArrayInt(filter_ids, filter_id) {
 					filter_ids = append(filter_ids, filter_id)
@@ -148,7 +148,7 @@ func (this *Modules) shop_GetFilterValuesInputs(wrap *wrapper.Wrapper, filter_id
 		}
 		for rows.Next() {
 			err = rows.Scan(scan...)
-			if err == nil {
+			if wrap.LogCpError(err) == nil {
 				result += `<div class="form-group position-relative"><input class="form-control" type="text" name="value.` + html.EscapeString(string(values[0])) + `" value="` + html.EscapeString(string(values[1])) + `" placeholder="" autocomplete="off" required><button type="button" class="btn btn-danger btn-dynamic-remove" onclick="fave.ShopAttributesRemove(this);">&times;</button></div>`
 			}
 		}
@@ -179,7 +179,7 @@ func (this *Modules) shop_GetAllAttributesSelectOptions(wrap *wrapper.Wrapper) s
 		}
 		for rows.Next() {
 			err = rows.Scan(scan...)
-			if err == nil {
+			if wrap.LogCpError(err) == nil {
 				result += `<option title="` + html.EscapeString(string(values[1])) + `" value="` + html.EscapeString(string(values[0])) + `">` + html.EscapeString(string(values[1])) + `</option>`
 			}
 		}
@@ -208,7 +208,7 @@ func (this *Modules) shop_GetAllCurrencies(wrap *wrapper.Wrapper) map[int]string
 		}
 		for rows.Next() {
 			err = rows.Scan(scan...)
-			if err == nil {
+			if wrap.LogCpError(err) == nil {
 				result[utils.StrToInt(string(values[0]))] = html.EscapeString(string(values[1]))
 			}
 		}
@@ -241,7 +241,7 @@ func (this *Modules) shop_GetAllProductImages(wrap *wrapper.Wrapper, product_id
 		}
 		for rows.Next() {
 			err = rows.Scan(scan...)
-			if err == nil {
+			if wrap.LogCpError(err) == nil {
 				result += `<div class="attached-img" data-id="` + html.EscapeString(string(values[0])) + `"><a href="/products/images/` + html.EscapeString(string(values[1])) + `/` + html.EscapeString(string(values[2])) + `" title="` + html.EscapeString(string(values[2])) + `" target="_blank"><img id="pimg_` + string(values[1]) + `_` + strings.Replace(string(values[2]), ".", "_", -1) + `" src="/products/images/` + string(values[1]) + `/thumb-0-` + string(values[2]) + `" onerror="WaitForFave(function(){fave.ShopProductsRetryImage(this, 'pimg_` + string(values[1]) + `_` + strings.Replace(string(values[2]), ".", "_", -1) + `');});" /></a><a class="remove" onclick="fave.ShopProductsDeleteImage(this, ` + html.EscapeString(string(values[1])) + `, '` + html.EscapeString(string(values[2])) + `');"><svg viewBox="1 1 11 14" width="10" height="12" class="sicon" version="1.1"><path fill-rule="evenodd" d="M11 2H9c0-.55-.45-1-1-1H5c-.55 0-1 .45-1 1H2c-.55 0-1 .45-1 1v1c0 .55.45 1 1 1v9c0 .55.45 1 1 1h7c.55 0 1-.45 1-1V5c.55 0 1-.45 1-1V3c0-.55-.45-1-1-1zm-1 12H3V5h1v8h1V5h1v8h1V5h1v8h1V5h1v9zm1-10H2V3h9v1z"></path></svg></a></div>`
 			}
 		}
@@ -364,6 +364,7 @@ func (this *Modules) RegisterModule_Shop() *Module {
 
 			if err != nil && err != wrapper.ErrNoRows {
 				// System error 500
+				wrap.LogCpError(err)
 				utils.SystemErrorPageEngine(wrap.W, err)
 				return
 			} else if err == wrapper.ErrNoRows {
@@ -438,6 +439,7 @@ func (this *Modules) RegisterModule_Shop() *Module {
 
 			if err != nil && err != wrapper.ErrNoRows {
 				// System error 500
+				wrap.LogCpError(err)
 				utils.SystemErrorPageEngine(wrap.W, err)
 				return
 			} else if err == wrapper.ErrNoRows {
@@ -808,19 +810,20 @@ func (this *Modules) RegisterModule_Shop() *Module {
 			}
 
 			data := utils.MySql_shop_product{
-				A_id:       0,
-				A_user:     0,
-				A_currency: 0,
-				A_price:    0,
-				A_name:     "",
-				A_alias:    "",
-				A_vendor:   "",
-				A_quantity: 0,
-				A_category: 0,
-				A_briefly:  "",
-				A_content:  "",
-				A_datetime: 0,
-				A_active:   0,
+				A_id:        0,
+				A_parent_id: 0,
+				A_user:      0,
+				A_currency:  0,
+				A_price:     0,
+				A_name:      "",
+				A_alias:     "",
+				A_vendor:    "",
+				A_quantity:  0,
+				A_category:  0,
+				A_briefly:   "",
+				A_content:   "",
+				A_datetime:  0,
+				A_active:    0,
 			}
 
 			if wrap.CurrSubModule == "modify" {
@@ -833,6 +836,7 @@ func (this *Modules) RegisterModule_Shop() *Module {
 				err := wrap.DB.QueryRow(`
 					SELECT
 						id,
+						parent_id,
 						user,
 						currency,
 						price,
@@ -852,6 +856,7 @@ func (this *Modules) RegisterModule_Shop() *Module {
 					utils.StrToInt(wrap.UrlArgs[2]),
 				).Scan(
 					&data.A_id,
+					&data.A_parent_id,
 					&data.A_user,
 					&data.A_currency,
 					&data.A_price,
@@ -864,7 +869,7 @@ func (this *Modules) RegisterModule_Shop() *Module {
 					&data.A_content,
 					&data.A_active,
 				)
-				if err != nil {
+				if wrap.LogCpError(err) != nil {
 					return "", "", ""
 				}
 			}
@@ -882,7 +887,7 @@ func (this *Modules) RegisterModule_Shop() *Module {
 					}
 					for rows.Next() {
 						err = rows.Scan(scan...)
-						if err == nil {
+						if wrap.LogCpError(err) == nil {
 							selids = append(selids, int(values[0]))
 						}
 					}
@@ -1165,7 +1170,7 @@ func (this *Modules) RegisterModule_Shop() *Module {
 					&data.A_lft,
 					&data.A_rgt,
 				)
-				if err != nil {
+				if wrap.LogCpError(err) != nil {
 					return "", "", ""
 				}
 			}
@@ -1285,7 +1290,7 @@ func (this *Modules) RegisterModule_Shop() *Module {
 					&data.A_name,
 					&data.A_filter,
 				)
-				if err != nil {
+				if wrap.LogCpError(err) != nil {
 					return "", "", ""
 				}
 			}
@@ -1407,7 +1412,7 @@ func (this *Modules) RegisterModule_Shop() *Module {
 					&data.A_code,
 					&data.A_symbol,
 				)
-				if err != nil {
+				if wrap.LogCpError(err) != nil {
 					return "", "", ""
 				}
 			}

+ 2 - 2
modules/module_shop_act_duplicate.go

@@ -100,7 +100,7 @@ func (this *Modules) RegisterAction_ShopDuplicate() *Action {
 				for cat_rows.Next() {
 					var product_id int
 					var category_id int
-					if err := cat_rows.Scan(&product_id, &category_id); err == nil {
+					if err := cat_rows.Scan(&product_id, &category_id); wrap.LogCpError(err) == nil {
 						cat_sqls = append(cat_sqls, `
 							INSERT INTO shop_cat_product_rel SET
 								product_id = `+utils.Int64ToStr(lastID)+`,
@@ -131,7 +131,7 @@ func (this *Modules) RegisterAction_ShopDuplicate() *Action {
 				for attributes_rows.Next() {
 					var product_id int
 					var filter_value_id int
-					if err := attributes_rows.Scan(&product_id, &filter_value_id); err == nil {
+					if err := attributes_rows.Scan(&product_id, &filter_value_id); wrap.LogCpError(err) == nil {
 						attributes_sqls = append(attributes_sqls, `
 							INSERT INTO shop_filter_product_values SET
 								product_id = `+utils.Int64ToStr(lastID)+`,

+ 1 - 1
modules/module_shop_act_get_attribute_values.go

@@ -43,7 +43,7 @@ func (this *Modules) RegisterAction_ShopGetAttributeValues() *Action {
 			}
 			for rows.Next() {
 				err = rows.Scan(scan...)
-				if err == nil {
+				if wrap.LogCpError(err) == nil {
 					options += `<option value="` + html.EscapeString(string(values[0])) + `">` + html.EscapeString(utils.JavaScriptVarValue(string(values[1]))) + `</option>`
 				}
 			}

+ 2 - 2
modules/module_shop_act_modify.go

@@ -148,7 +148,7 @@ func (this *Modules) RegisterAction_ShopModify() *Action {
 					).Scan(
 						&catsCount,
 					)
-					if err != nil {
+					if wrap.LogCpError(err) != nil {
 						return err
 					}
 					if len(catids) != catsCount {
@@ -256,7 +256,7 @@ func (this *Modules) RegisterAction_ShopModify() *Action {
 					).Scan(
 						&catsCount,
 					)
-					if err != nil {
+					if wrap.LogCpError(err) != nil {
 						return err
 					}
 					if len(catids) != catsCount {

+ 2 - 2
modules/module_shop_categories.go

@@ -40,7 +40,7 @@ func (this *Modules) shop_GetCategorySelectOptions(wrap *wrapper.Wrapper, id int
 		parentIdStr := utils.IntToStr(parentId)
 		for rows.Next() {
 			err = rows.Scan(scan...)
-			if err == nil {
+			if wrap.LogCpError(err) == nil {
 				disabled := ""
 				if string(values[0]) == idStr {
 					disabled = " disabled"
@@ -84,7 +84,7 @@ func (this *Modules) shop_GetCategoryParentId(wrap *wrapper.Wrapper, id int) int
 	).Scan(
 		&parentId,
 	)
-	if err != nil {
+	if wrap.LogCpError(err) != nil {
 		return 0
 	}
 	return parentId

+ 4 - 4
modules/module_shop_categories_act_modify.go

@@ -76,13 +76,13 @@ func (this *Modules) shop_ActionCategoryUpdate(wrap *wrapper.Wrapper, pf_id, pf_
 
 		var parentL int
 		var parentR int
-		if err := tx.QueryRow(`SELECT lft, rgt FROM shop_cats WHERE id = ?;`, utils.StrToInt(pf_parent)).Scan(&parentL, &parentR); err != nil {
+		if err := tx.QueryRow(`SELECT lft, rgt FROM shop_cats WHERE id = ?;`, utils.StrToInt(pf_parent)).Scan(&parentL, &parentR); wrap.LogCpError(err) != nil {
 			return err
 		}
 
 		var targetL int
 		var targetR int
-		if err := tx.QueryRow(`SELECT lft, rgt FROM shop_cats WHERE id = ?;`, utils.StrToInt(pf_id)).Scan(&targetL, &targetR); err != nil {
+		if err := tx.QueryRow(`SELECT lft, rgt FROM shop_cats WHERE id = ?;`, utils.StrToInt(pf_id)).Scan(&targetL, &targetR); wrap.LogCpError(err) != nil {
 			return err
 		}
 
@@ -100,7 +100,7 @@ func (this *Modules) shop_ActionCategoryUpdate(wrap *wrapper.Wrapper, pf_id, pf_
 				var row_id int
 				var row_lft int
 				var row_rgt int
-				if err := rows.Scan(&row_id, &row_lft, &row_rgt); err == nil {
+				if err := rows.Scan(&row_id, &row_lft, &row_rgt); wrap.LogCpError(err) == nil {
 					rows_id = append(rows_id, row_id)
 					rows_lft = append(rows_lft, row_lft)
 					rows_rgt = append(rows_rgt, row_rgt)
@@ -210,7 +210,7 @@ func (this *Modules) RegisterAction_ShopCategoriesModify() *Action {
 				LIMIT 1;`,
 				utils.StrToInt(pf_parent),
 			).Scan(&parentId)
-			if err != nil {
+			if wrap.LogCpError(err) != nil {
 				wrap.MsgError(err.Error())
 				return
 			}

+ 1 - 1
modules/module_users.go

@@ -147,7 +147,7 @@ func (this *Modules) RegisterModule_Users() *Module {
 					&data.A_admin,
 					&data.A_active,
 				)
-				if err != nil {
+				if wrap.LogCpError(err) != nil {
 					return "", "", ""
 				}
 			}

+ 14 - 13
utils/mysql_struct_shop_product.go

@@ -1,17 +1,18 @@
 package utils
 
 type MySql_shop_product struct {
-	A_id       int
-	A_user     int
-	A_currency int
-	A_price    float64
-	A_name     string
-	A_alias    string
-	A_vendor   string
-	A_quantity int
-	A_category int
-	A_briefly  string
-	A_content  string
-	A_datetime int
-	A_active   int
+	A_id        int
+	A_parent_id int
+	A_user      int
+	A_currency  int
+	A_price     float64
+	A_name      string
+	A_alias     string
+	A_vendor    string
+	A_quantity  int
+	A_category  int
+	A_briefly   string
+	A_content   string
+	A_datetime  int
+	A_active    int
 }