-
Notifications
You must be signed in to change notification settings - Fork 18.3k
Closed
Labels
FrozenDueToAgeNeedsInvestigationSomeone must examine and confirm this is a valid issue and not a duplicate of an existing one.Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.
Milestone
Description
What version of Go are you using (go version
)?
$ go version go1.15.2
Does this issue reproduce with the latest release?
I think so, yes.
What operating system and processor architecture are you using (go env
)?
go env
Output
$ go env GO111MODULE="" GOARCH="amd64" GOBIN="" GOCACHE="/Users/zeisss/Library/Caches/go-build" GOENV="/Users/zeisss/Library/Application Support/go/env" GOEXE="" GOFLAGS="" GOHOSTARCH="amd64" GOHOSTOS="darwin" GOINSECURE="" GOMODCACHE="/Users/zeisss/go/pkg/mod" GONOPROXY="" GONOSUMDB="" GOOS="darwin" GOPATH="/Users/zeisss/go" GOPRIVATE="" GOPROXY="https://proxy.golang.org,direct" GOROOT="/usr/local/Cellar/go/1.15.2/libexec" GOSUMDB="sum.golang.org" GOTMPDIR="" GOTOOLDIR="/usr/local/Cellar/go/1.15.2/libexec/pkg/tool/darwin_amd64" GCCGO="gccgo" AR="ar" CC="clang" CXX="clang++" CGO_ENABLED="1" GOMOD="" CGO_CFLAGS="-g -O2" CGO_CPPFLAGS="" CGO_CXXFLAGS="-g -O2" CGO_FFLAGS="-g -O2" CGO_LDFLAGS="-g -O2" PKG_CONFIG="pkg-config" GOGCCFLAGS="-fPIC -m64 -pthread -fno-caret-diagnostics -Qunused-arguments -fmessage-length=0 -fdebug-prefix-map=/var/folders/x0/0_rddyy16qn1sy9n_pclmxqh0000gn/T/go-build239938081=/tmp/go-build -gno-record-gcc-switches -fno-common"
What did you do?
- Performed a http request via
net/http.Client
- Received a
net/http.nothingWrittenError
(write tcp 172.31.16.237:54422->1.2.3.4:80: write: connection reset by peer
) - Tried checking it with
var opError *net.OpError; if errors.As(err, &opsError) { ... }
to map to a user friendly errorcode - Error gets reported as an unknown error Rollbar, thus I know it is a
http.nothingWrittenError
.
What did you expect to see?
I expected errors.As()
to return true for this error
What did you see instead?
I saw errors.As()
returning false.
I believe the problem to occur, since the error is neither the right type nor does Unwrap()
return the OpError
error at any point (since it is directly in http.nothingWrittenError
. The same problem can be observed for errors.Is()
. See https://play.golang.org/p/0XhEPLe0bRy
Use Case
We are running a load test generator written in Go and we need to provide our users with an aggregated error report, thus we need to be able to unpack and understand the errors we receive.
tisba and yuxh1996
Metadata
Metadata
Assignees
Labels
FrozenDueToAgeNeedsInvestigationSomeone must examine and confirm this is a valid issue and not a duplicate of an existing one.Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.