github.com/tencent/goom@v1.0.1/erro/illegal_param_type.go (about) 1 package erro 2 3 import "fmt" 4 5 // IllegalParamType 参数类型错误异常 6 type IllegalParamType struct { 7 paramName string 8 paramType string 9 expectType string 10 } 11 12 // Error 返回错误字符串 13 func (i *IllegalParamType) Error() string { 14 return fmt.Sprintf("Illegal param type error, param: %s, type:%s, expect type: %s", 15 i.paramName, i.paramType, i.expectType) 16 } 17 18 // NewIllegalParamTypeError 创建参数类型异常 19 // paramName 参数名 20 // paramType 参数类型 21 // expectType 期望类型 22 func NewIllegalParamTypeError(paramName string, paramType, expectType string) error { 23 return &IllegalParamType{paramName: paramName, paramType: paramType, expectType: expectType} 24 }