Skip to content

Commit

Permalink
modify error msg (dapr#1897)
Browse files Browse the repository at this point in the history
Signed-off-by: 1046102779 <seachen@tencent.com>

Co-authored-by: Bernd Verst <4535280+berndverst@users.noreply.github.com>
Signed-off-by: Andrew Duss <andy.duss@storable.com>
  • Loading branch information
2 people authored and Andrew Duss committed Aug 18, 2022
1 parent 1ccb4e4 commit 35febf1
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions bindings/alicloud/rocketmq/rocketmq.go
Original file line number Diff line number Diff line change
Expand Up @@ -90,11 +90,12 @@ func (a *AliCloudRocketMQ) Read(ctx context.Context, handler bindings.Handler) e
if topicStr == "" {
continue
}
mqType, mqExpression, topic, err := parseTopic(topicStr)
if err != nil {

var mqType, mqExpression, topic string
if mqType, mqExpression, topic, err = parseTopic(topicStr); err != nil {
return err
}
if err := consumer.Subscribe(
if err = consumer.Subscribe(
topic,
mqc.MessageSelector{
Type: mqc.ExpressionType(mqType),
Expand All @@ -106,7 +107,7 @@ func (a *AliCloudRocketMQ) Read(ctx context.Context, handler bindings.Handler) e
}
}

if err := consumer.Start(); err != nil {
if err = consumer.Start(); err != nil {
return fmt.Errorf("binding-rocketmq: consumer start failed. %w", err)
}

Expand All @@ -121,7 +122,7 @@ func (a *AliCloudRocketMQ) Read(ctx context.Context, handler bindings.Handler) e

innerErr := consumer.Shutdown()
if innerErr != nil && !errors.Is(innerErr, context.Canceled) {
a.logger.Warnf("binding-rocketmq: error while shutting down consumer: %v")
a.logger.Warnf("binding-rocketmq: error while shutting down consumer: %v", innerErr)
}
}()

Expand Down

0 comments on commit 35febf1

Please sign in to comment.