common-errors.go: exported all error functions.
builtin-string.go: renamed all functions from somthingStr() to strSomething()
This commit is contained in:
+6
-6
@@ -67,7 +67,7 @@ func boolFunc(ctx ExprContext, name string, args []any) (result any, err error)
|
||||
case string:
|
||||
result = len(v) > 0
|
||||
default:
|
||||
err = errCantConvert(name, v, "bool")
|
||||
err = ErrCantConvert(name, v, "bool")
|
||||
}
|
||||
return
|
||||
}
|
||||
@@ -90,7 +90,7 @@ func intFunc(ctx ExprContext, name string, args []any) (result any, err error) {
|
||||
result = int64(i)
|
||||
}
|
||||
default:
|
||||
err = errCantConvert(name, v, "int")
|
||||
err = ErrCantConvert(name, v, "int")
|
||||
}
|
||||
return
|
||||
}
|
||||
@@ -115,7 +115,7 @@ func decFunc(ctx ExprContext, name string, args []any) (result any, err error) {
|
||||
case *FractionType:
|
||||
result = v.toFloat()
|
||||
default:
|
||||
err = errCantConvert(name, v, "float")
|
||||
err = ErrCantConvert(name, v, "float")
|
||||
}
|
||||
return
|
||||
}
|
||||
@@ -127,9 +127,9 @@ func fractFunc(ctx ExprContext, name string, args []any) (result any, err error)
|
||||
if len(args) > 1 {
|
||||
var ok bool
|
||||
if den, ok = args[1].(int64); !ok {
|
||||
err = errExpectedGot(name, "integer", args[1])
|
||||
err = ErrExpectedGot(name, "integer", args[1])
|
||||
} else if den == 0 {
|
||||
err = errFuncDivisionByZero(name)
|
||||
err = ErrFuncDivisionByZero(name)
|
||||
}
|
||||
}
|
||||
if err == nil {
|
||||
@@ -148,7 +148,7 @@ func fractFunc(ctx ExprContext, name string, args []any) (result any, err error)
|
||||
case *FractionType:
|
||||
result = v
|
||||
default:
|
||||
err = errCantConvert(name, v, "float")
|
||||
err = ErrCantConvert(name, v, "float")
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user