gitee.com/quant1x/num@v0.3.2/errors.go (about) 1 package num 2 3 import ( 4 "errors" 5 "fmt" 6 "reflect" 7 ) 8 9 const ( 10 errorTypeBase = 0 11 ) 12 13 var ( 14 // ErrUnsupportedType 不支持的类型 15 ErrUnsupportedType = errors.New("unsupported type") 16 ErrRange = errors.New("range error") 17 ErrInvalidWindow = errors.New("error window") 18 ) 19 20 // TypeError 类型错误 21 func TypeError(tv any) error { 22 typeName := reflect.TypeOf(tv).String() 23 return fmt.Errorf("unsupported type: " + typeName) 24 }