Skip to content
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 7 additions & 7 deletions googlebus/googlebus.go
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ func New(log logger.Logger, projectID string, topicIDs []string, opts ...Options

client, err := gpubsub.NewClient(context.Background(), projectID)
if err != nil {
return nil, err
return nil, fmt.Errorf("googlebus: failed to create pubsub client: %w", err)
}

bus := &GoogleBus{
Expand Down Expand Up @@ -157,7 +157,7 @@ func (m *GoogleBus) Publish(ctx context.Context, topicID string, message *Messag
m.pubCheck = time.Now()
_, err := result.Get(context.Background())
if err != nil {
return err
return fmt.Errorf("googlebus: result.Get: %w", err)
}
}

Expand All @@ -175,7 +175,7 @@ func (m *GoogleBus) Subscribe(ctx context.Context, topicID string, optSubcriptio

s, err := m.SetupSubscription(topicID, subscriptionID)
if err != nil {
return nil, err
return nil, fmt.Errorf("googlebus: failed to setup subscription: %w", err)
}

s.ReceiveSettings = m.options.ReceiveSettings
Expand Down Expand Up @@ -236,7 +236,7 @@ func (m *GoogleBus) SetupTopic(topicID string) (*gpubsub.Topic, error) {
t = m.client.Topic(topicID)
exists, err := t.Exists(context.Background())
if err != nil {
return nil, err
return nil, fmt.Errorf("googlebus: could not check if topic exists: %w", err)
}
if exists {
m.topics[topicID] = t
Expand All @@ -246,7 +246,7 @@ func (m *GoogleBus) SetupTopic(topicID string) (*gpubsub.Topic, error) {
// Create a new topic if one doesn't exist
t, err = m.client.CreateTopic(context.Background(), topicID)
if err != nil {
return nil, err
return nil, fmt.Errorf("googlebus: create topic: %w", err)
}
t.PublishSettings = m.options.PublishSettings

Expand All @@ -263,7 +263,7 @@ func (m *GoogleBus) SetupSubscription(topicID, subscriptionID string) (*gpubsub.
s = m.client.Subscription(subscriptionID)
exists, err := s.Exists(context.Background())
if err != nil {
return nil, err
return nil, fmt.Errorf("googlebus: could not check if subscription exists: %w", err)
}
if exists {
if m.subs[topicID] == nil {
Expand All @@ -279,7 +279,7 @@ func (m *GoogleBus) SetupSubscription(topicID, subscriptionID string) (*gpubsub.

s, err = m.client.CreateSubscription(context.Background(), subscriptionID, subConfig)
if err != nil {
return nil, err
return nil, fmt.Errorf("googlebus: could not create subscription: %w", err)
}

if m.subs[topicID] == nil {
Expand Down