MCPcopy Create free account
hub / github.com/couchbase/sync_gateway / IsConnectionRefusedError

Function IsConnectionRefusedError

base/util.go:1632–1646  ·  view source on GitHub ↗

IsConnectionRefusedError returns true if the given error is due to a connection being actively refused.

(err error)

Source from the content-addressed store, hash-verified

1630
1631// IsConnectionRefusedError returns true if the given error is due to a connection being actively refused.
1632func IsConnectionRefusedError(err error) bool {
1633 if err == nil {
1634 return false
1635 }
1636
1637 var errorMessage string
1638 switch runtime.GOOS {
1639 case "linux", "darwin":
1640 errorMessage = "connection refused"
1641 case "windows":
1642 errorMessage = "target machine actively refused"
1643 }
1644
1645 return strings.Contains(err.Error(), errorMessage)
1646}
1647
1648// ConfigDuration is a time.Duration that supports JSON marshalling/unmarshalling.
1649// Underlying duration cannot be embedded due to requiring reflect access for mergo.

Callers 1

Calls 2

ContainsMethod · 0.65
ErrorMethod · 0.45

Tested by 1