exportedErrType returns the underlying type name of err if it's exported. Otherwise, it returns an empty string.
(err error)
| 151 | // exportedErrType returns the underlying type name of err if it's exported. |
| 152 | // Otherwise, it returns an empty string. |
| 153 | func exportedErrType(err error) string { |
| 154 | t := reflect.TypeOf(err) |
| 155 | if t == nil { |
| 156 | return "" |
| 157 | } |
| 158 | if t.Kind() == reflect.Pointer { |
| 159 | t = t.Elem() |
| 160 | } |
| 161 | name := t.Name() |
| 162 | if r, _ := utf8.DecodeRuneInString(name); unicode.IsUpper(r) { |
| 163 | return t.String() |
| 164 | } |
| 165 | return "" |
| 166 | } |
| 167 | |
| 168 | // splitPkgFunc splits a fully-qualified function or method name into its |
| 169 | // package path and base name components. |
no test coverage detected