Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

context: DeadlineExceeded doesn't implement net.Error interface #14238

Closed
abursavich opened this issue Feb 5, 2016 · 5 comments
Closed

context: DeadlineExceeded doesn't implement net.Error interface #14238

abursavich opened this issue Feb 5, 2016 · 5 comments
Milestone

Comments

@abursavich
Copy link

It's a common pattern to test for timeout errors by asserting (a subset of) the net.Error interface and calling the Timeout method.

func isTimeout(err error) bool {
    te, ok := err.(interface{ Timeout() bool })
    return ok && te.Timeout()
}

DeadlineExceeded timeouts should not require a special case.

@bradfitz bradfitz self-assigned this Apr 9, 2016
@bradfitz bradfitz added this to the Go1.7 milestone Apr 9, 2016
@bradfitz bradfitz assigned Sajmani and unassigned bradfitz May 10, 2016
@bradfitz
Copy link
Contributor

@Sajmani, has this ever been discussed?

@davecheney
Copy link
Contributor

This seems like a reasonable request.

On Wed, 11 May 2016, 09:14 Brad Fitzpatrick, notifications@github.com
wrote:

@Sajmani https://github.com/Sajmani, has this ever been discussed?


You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub
#14238 (comment)

@rsc
Copy link
Contributor

rsc commented May 18, 2016

Seems like a good idea to me and worth doing for Go 1.7 since context is new there.

@rsc rsc changed the title x/net/context: DeadlineExceeded doesn't implement net.Error interface context: DeadlineExceeded doesn't implement net.Error interface May 18, 2016
@bradfitz bradfitz assigned bradfitz and unassigned Sajmani May 19, 2016
@gopherbot
Copy link

CL https://golang.org/cl/23256 mentions this issue.

@gopherbot
Copy link

CL https://golang.org/cl/30370 mentions this issue.

gopherbot pushed a commit that referenced this issue Oct 5, 2016
It already implemented the Timeout method,
but implementing the full net.Error is more convenient.

Fixes #14238 (again).

Change-Id: Ia87f897f0f35bcb49865e2355964049227951ca6
Reviewed-on: https://go-review.googlesource.com/30370
Run-TryBot: Russ Cox <rsc@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
@golang golang locked and limited conversation to collaborators Oct 5, 2017
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

6 participants