Skip to content

Commit cc35e61

Browse files
authored
Don't ignore error in InitThriftClient (#61)
`thrift.NewTHttpClientWithOptions` may return an error, in which case `tTrans` is `nil`, which causes the next line to panic with the message `interface conversion: thrift.TTransport is nil, not *thrift.THttpClient` on the next line. Signed-off-by: Eric Bannatyne <[email protected]>
1 parent 5883857 commit cc35e61

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

internal/client/client.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -212,6 +212,10 @@ func InitThriftClient(cfg *config.Config) (*ThriftServiceClient, error) {
212212
Timeout: cfg.ClientTimeout,
213213
}
214214
tTrans, err = thrift.NewTHttpClientWithOptions(endpoint, thrift.THttpClientOptions{Client: httpclient})
215+
if err != nil {
216+
return nil, err
217+
}
218+
215219
httpTransport := tTrans.(*thrift.THttpClient)
216220
userAgent := fmt.Sprintf("%s/%s", cfg.DriverName, cfg.DriverVersion)
217221
if cfg.UserAgentEntry != "" {

0 commit comments

Comments
 (0)