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

master
qiying.wang 2 years ago committed by Kevin Wan
parent 1cd1b17f70
commit 148afcf1a7

@ -213,23 +213,23 @@ func (s *Set) validate(i any) {
switch i.(type) { switch i.(type) {
case int: case int:
if s.tp != intType { 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: case int64:
if s.tp != int64Type { 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: case uint:
if s.tp != uintType { 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: case uint64:
if s.tp != uint64Type { 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: case string:
if s.tp != stringType { 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)
} }
} }
} }

@ -1009,7 +1009,7 @@ func newInitError(name string) error {
} }
func newTypeMismatchError(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 { func readKeys(key string) []string {

@ -66,7 +66,7 @@ func format(query string, args ...any) (string, error) {
switch ch { switch ch {
case '?': case '?':
if argIndex >= numArgs { 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]) writeValue(&b, args[argIndex])
@ -93,7 +93,7 @@ func format(query string, args ...any) (string, error) {
index-- index--
if index < 0 || numArgs <= 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]) writeValue(&b, args[index])
@ -124,7 +124,7 @@ func format(query string, args ...any) (string, error) {
} }
if argIndex < numArgs { 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 return b.String(), nil

@ -53,7 +53,7 @@ func format(query string, args ...any) (string, error) {
for _, ch := range query { for _, ch := range query {
if ch == '?' { if ch == '?' {
if argIndex >= numArgs { 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] arg := args[argIndex]
@ -79,7 +79,7 @@ func format(query string, args ...any) (string, error) {
} }
if argIndex < numArgs { 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 return b.String(), nil

Loading…
Cancel
Save