MCPcopy Index your code
hub / github.com/coder/coder / IsConnectionError

Function IsConnectionError

codersdk/client.go:628–637  ·  view source on GitHub ↗

IsConnectionError is a convenience function for checking if the source of an error is due to a 'connection refused', 'no such host', etc.

(err error)

Source from the content-addressed store, hash-verified

626// IsConnectionError is a convenience function for checking if the source of an
627// error is due to a 'connection refused', 'no such host', etc.
628func IsConnectionError(err error) bool {
629 var (
630 // E.g. no such host
631 dnsErr *net.DNSError
632 // Eg. connection refused
633 opErr *net.OpError
634 )
635
636 return xerrors.As(err, &dnsErr) || xerrors.As(err, &opErr)
637}
638
639func AsError(err error) (*Error, bool) {
640 var e *Error

Callers 2

isRetryableErrorFunction · 0.92
TestIsConnectionErrFunction · 0.85

Calls 1

AsMethod · 0.80

Tested by 1

TestIsConnectionErrFunction · 0.68