forked from quic-go/quic-go
fix incorrect usage of errors.Is
errors.Is is supposed to used for equality of errors, not for type assertions. That's what errors.As is there for.
This commit is contained in:
@@ -6,50 +6,9 @@ import (
|
||||
"net"
|
||||
)
|
||||
|
||||
func (e *TransportError) Is(target error) bool {
|
||||
_, ok := target.(*TransportError)
|
||||
if ok {
|
||||
return true
|
||||
}
|
||||
return target == net.ErrClosed
|
||||
}
|
||||
|
||||
func (e *ApplicationError) Is(target error) bool {
|
||||
_, ok := target.(*ApplicationError)
|
||||
if ok {
|
||||
return true
|
||||
}
|
||||
return target == net.ErrClosed
|
||||
}
|
||||
|
||||
func (e *IdleTimeoutError) Is(target error) bool {
|
||||
_, ok := target.(*IdleTimeoutError)
|
||||
if ok {
|
||||
return true
|
||||
}
|
||||
return target == net.ErrClosed
|
||||
}
|
||||
|
||||
func (e *HandshakeTimeoutError) Is(target error) bool {
|
||||
_, ok := target.(*HandshakeTimeoutError)
|
||||
if ok {
|
||||
return true
|
||||
}
|
||||
return target == net.ErrClosed
|
||||
}
|
||||
|
||||
func (e *VersionNegotiationError) Is(target error) bool {
|
||||
_, ok := target.(*VersionNegotiationError)
|
||||
if ok {
|
||||
return true
|
||||
}
|
||||
return target == net.ErrClosed
|
||||
}
|
||||
|
||||
func (e *StatelessResetError) Is(target error) bool {
|
||||
_, ok := target.(*StatelessResetError)
|
||||
if ok {
|
||||
return true
|
||||
}
|
||||
return target == net.ErrClosed
|
||||
}
|
||||
func (e *TransportError) Is(target error) bool { return target == net.ErrClosed }
|
||||
func (e *ApplicationError) Is(target error) bool { return target == net.ErrClosed }
|
||||
func (e *IdleTimeoutError) Is(target error) bool { return target == net.ErrClosed }
|
||||
func (e *HandshakeTimeoutError) Is(target error) bool { return target == net.ErrClosed }
|
||||
func (e *VersionNegotiationError) Is(target error) bool { return target == net.ErrClosed }
|
||||
func (e *StatelessResetError) Is(target error) bool { return target == net.ErrClosed }
|
||||
|
||||
Reference in New Issue
Block a user