If you look at the type of the error returned, it's probably a *url.Error. 
 In that case you case you can get the original error from the network read 
in the Err field. Something like:

if err, ok := err.(*url.Error); ok {
if err.Err == io.EOF {
log.Fatal("received io.EOF during request")
}
}



On Monday, August 8, 2016 at 8:26:04 AM UTC-4, Bruno Albuquerque wrote:
>
> I am seeing a weird issue when using Client.Do() to do a request. Here is 
> the scenario:
>
> go version go1.7rc5 linux/amd64
>
> The server I am sending the request to, receives it and, for this specific 
> request, closes the connection immediately without sending any replies. To 
> detect this, I wanted to compare the result error against io.EOF and that 
> failed. The reason is because the actual error is a custom error:
>
> Post [URL]: EOF
>
> This makes it complicated to check for this condition. The best approach I 
> could come up with was checking if the string suffix was EOF which is weird 
> at the very least.
>
> Am I missing something?
>

-- 
You received this message because you are subscribed to the Google Groups 
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to golang-nuts+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to