Skip to content

Commit

Permalink
Merge pull request #342 from charlievieth/remove-regex
Browse files Browse the repository at this point in the history
nats: simplify error check in Conn.connect
  • Loading branch information
kozlovic authored Feb 18, 2018
2 parents c7e16c2 + 5406b8c commit 45807e5
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions nats.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ import (
"math/rand"
"net"
"net/url"
"regexp"
"runtime"
"strconv"
"strings"
Expand Down Expand Up @@ -1109,7 +1108,7 @@ func (nc *Conn) connect() error {
} else {
// Cancel out default connection refused, will trigger the
// No servers error conditional
if matched, _ := regexp.Match(`connection refused`, []byte(err.Error())); matched {
if strings.Contains(err.Error(), "connection refused") {
returnedErr = nil
}
}
Expand Down

0 comments on commit 45807e5

Please sign in to comment.