Skip to content

Commit dfc4e9c

Browse files
author
李聪
committed
optimize code
1 parent 8702be7 commit dfc4e9c

File tree

1 file changed

+3
-8
lines changed

1 file changed

+3
-8
lines changed

util.go

+3-8
Original file line numberDiff line numberDiff line change
@@ -49,15 +49,10 @@ func urlJoin(base string, pathes ...string) string {
4949
}
5050

5151
func wrapperTimeOutError(err error) error {
52-
switch e := err.(type) {
53-
case net.Error:
54-
if e.Timeout() {
55-
return fmt.Errorf("timeout")
56-
}
57-
return err
58-
default:
59-
return err
52+
if IsTimeOutError(err) {
53+
return fmt.Errorf("timeout")
6054
}
55+
return err
6156
}
6257

6358
func IsTimeOutError(err error) bool {

0 commit comments

Comments
 (0)