Pārlūkot izejas kodu

chore: remove redundant prefix of "error: " in error creation

qiying.wang 2 gadi atpakaļ
vecāks
revīzija
148afcf1a7

+ 5 - 5
core/collection/set.go

@@ -213,23 +213,23 @@ func (s *Set) validate(i any) {
 	switch i.(type) {
 	case int:
 		if s.tp != intType {
-			logx.Errorf("Error: element is int, but set contains elements with type %d", s.tp)
+			logx.Errorf("element is int, but set contains elements with type %d", s.tp)
 		}
 	case int64:
 		if s.tp != int64Type {
-			logx.Errorf("Error: element is int64, but set contains elements with type %d", s.tp)
+			logx.Errorf("element is int64, but set contains elements with type %d", s.tp)
 		}
 	case uint:
 		if s.tp != uintType {
-			logx.Errorf("Error: element is uint, but set contains elements with type %d", s.tp)
+			logx.Errorf("element is uint, but set contains elements with type %d", s.tp)
 		}
 	case uint64:
 		if s.tp != uint64Type {
-			logx.Errorf("Error: element is uint64, but set contains elements with type %d", s.tp)
+			logx.Errorf("element is uint64, but set contains elements with type %d", s.tp)
 		}
 	case string:
 		if s.tp != stringType {
-			logx.Errorf("Error: element is string, but set contains elements with type %d", s.tp)
+			logx.Errorf("element is string, but set contains elements with type %d", s.tp)
 		}
 	}
 }

+ 1 - 1
core/mapping/unmarshaler.go

@@ -1009,7 +1009,7 @@ func newInitError(name string) error {
 }
 
 func newTypeMismatchError(name string) error {
-	return fmt.Errorf("error: type mismatch for field %s", name)
+	return fmt.Errorf("type mismatch for field %s", name)
 }
 
 func readKeys(key string) []string {

+ 3 - 3
core/stores/sqlx/utils.go

@@ -66,7 +66,7 @@ func format(query string, args ...any) (string, error) {
 		switch ch {
 		case '?':
 			if argIndex >= numArgs {
-				return "", fmt.Errorf("error: %d ? in sql, but less arguments provided", argIndex)
+				return "", fmt.Errorf("%d ? in sql, but less arguments provided", argIndex)
 			}
 
 			writeValue(&b, args[argIndex])
@@ -93,7 +93,7 @@ func format(query string, args ...any) (string, error) {
 
 				index--
 				if index < 0 || numArgs <= index {
-					return "", fmt.Errorf("error: wrong index %d in sql", index)
+					return "", fmt.Errorf("wrong index %d in sql", index)
 				}
 
 				writeValue(&b, args[index])
@@ -124,7 +124,7 @@ func format(query string, args ...any) (string, error) {
 	}
 
 	if argIndex < numArgs {
-		return "", fmt.Errorf("error: %d arguments provided, not matching sql", argIndex)
+		return "", fmt.Errorf("%d arguments provided, not matching sql", argIndex)
 	}
 
 	return b.String(), nil

+ 2 - 2
tools/goctl/model/sql/test/utils.go

@@ -53,7 +53,7 @@ func format(query string, args ...any) (string, error) {
 	for _, ch := range query {
 		if ch == '?' {
 			if argIndex >= numArgs {
-				return "", fmt.Errorf("error: %d ? in sql, but less arguments provided", argIndex)
+				return "", fmt.Errorf("%d ? in sql, but less arguments provided", argIndex)
 			}
 
 			arg := args[argIndex]
@@ -79,7 +79,7 @@ func format(query string, args ...any) (string, error) {
 	}
 
 	if argIndex < numArgs {
-		return "", fmt.Errorf("error: %d ? in sql, but more arguments provided", argIndex)
+		return "", fmt.Errorf("%d ? in sql, but more arguments provided", argIndex)
 	}
 
 	return b.String(), nil