golang http Specifically check for timeout error
生活随笔
收集整理的這篇文章主要介紹了
golang http Specifically check for timeout error
小編覺得挺不錯的,現在分享給大家,幫大家做個參考.
Specifically check for timeout error
特異性識別 golang http client 的超時錯誤?
1 package main23 import (4 "fmt"5 "net"6 "net/http"7 )89 func main() {10 client := &http.Client{}11 _, err := client.Get("http://lsjkgj/kllsjkljg/jljsdglk")1213 fmt.Println(err.Error())1415 if oe, ok := err.(net.Error); ok {16 if oe.Timeout() {17 fmt.Println("timeout")18 }19 } else {20 fmt.Println("error")21 }22 }?
Get http://lsjkgj/kllsjkljg/jljsdglk: dial tcp: i/o timeout timeout?
轉載于:https://www.cnblogs.com/DillGao/p/7443703.html
總結
以上是生活随笔為你收集整理的golang http Specifically check for timeout error的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 【Lintcode】029.Interl
- 下一篇: 将sql 结果导出到文件