Skip to content
This repository was archived by the owner on Apr 16, 2024. It is now read-only.

Commit 6b34b8e

Browse files
authored
use error instead panic (#6)
1 parent 916e7f8 commit 6b34b8e

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

kafka/connection.go

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,13 @@ package kafka
33
import (
44
"context"
55
"fmt"
6-
"github.com/pkg/errors"
7-
k "github.com/segmentio/kafka-go"
86
"math"
97
"net"
108
"strconv"
119
"time"
10+
11+
"github.com/pkg/errors"
12+
k "github.com/segmentio/kafka-go"
1213
)
1314

1415
const (
@@ -192,7 +193,7 @@ func (c *Connection) GetTopic(name string) (*Topic, error) {
192193

193194
partitions, err := conn.ReadPartitions()
194195
if err != nil {
195-
panic(err.Error())
196+
return nil, err
196197
}
197198

198199
var numberOfPartitions int64 = 0

0 commit comments

Comments
 (0)