Skip to content

Commit

Permalink
Log no gRPC URL error.
Browse files Browse the repository at this point in the history
  • Loading branch information
matiasinsaurralde committed Oct 24, 2016
1 parent 005bbaf commit 5db12c5
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion coprocess_grpc.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import (
"net"
"net/url"
"time"
// "strings"
"errors"

"github.com/Sirupsen/logrus"
"github.com/TykTechnologies/tyk/coprocess"
Expand Down Expand Up @@ -40,6 +40,14 @@ func dialer(addr string, timeout time.Duration) (conn net.Conn, err error) {
return nil, err
}

if grpcUrl == nil || addr == "" {
var errString = "No gRPC URL is set!"
log.WithFields(logrus.Fields{
"prefix": "coprocess-grpc",
}).Error(errString)
return nil, errors.New(errString)
}

grpcUrlString := config.CoProcessOptions.CoProcessGRPCServer[len(grpcUrl.Scheme)+3 : len(config.CoProcessOptions.CoProcessGRPCServer)]

return net.DialTimeout(grpcUrl.Scheme, grpcUrlString, timeout)
Expand Down

0 comments on commit 5db12c5

Please sign in to comment.