Skip to content
Merged
Show file tree
Hide file tree
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
2 changes: 1 addition & 1 deletion bindings/smtp/smtp.go
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ func (s *Mailer) Invoke(req *bindings.InvokeRequest) (*bindings.InvokeResponse,
// Merge config metadata with request metadata
metadata := s.metadata.mergeWithRequestMetadata(req)
if metadata.EmailFrom == "" {
return nil, fmt.Errorf("smtp binding error: fromEmail property not supplied in configuration- or request-metadata")
return nil, fmt.Errorf("smtp binding error: emailFrom property not supplied in configuration- or request-metadata")
}
if metadata.EmailTo == "" {
return nil, fmt.Errorf("smtp binding error: emailTo property not supplied in configuration- or request-metadata")
Expand Down
9 changes: 8 additions & 1 deletion pubsub/azure/servicebus/servicebus.go
Original file line number Diff line number Diff line change
Expand Up @@ -413,7 +413,14 @@ func (a *azureServiceBus) Subscribe(req pubsub.SubscribeRequest, handler pubsub.
a.metadata.MaxActiveMessages,
a.metadata.MaxActiveMessagesRecoveryInSec)
if innerErr != nil {
a.logger.Error(innerErr)
var detachError *amqp.DetachError
var ampqError *amqp.Error
if errors.Is(innerErr, detachError) ||
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

*amqp.Error is the most likely terror received, but I'm also detecting *amqp.DetachError in case.

(errors.As(innerErr, &ampqError) && ampqError.Condition == amqp.ErrorDetachForced) {
a.logger.Debug(innerErr)
} else {
a.logger.Error(innerErr)
}
}
cancel() // Cancel receive context

Expand Down
7 changes: 1 addition & 6 deletions pubsub/azure/servicebus/subscription.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ package servicebus
import (
"context"
"fmt"
"strings"
"sync"
"time"

Expand Down Expand Up @@ -203,11 +202,7 @@ func (s *subscription) tryRenewLocks() {
func (s *subscription) receiveMessage(ctx context.Context, handler azservicebus.HandlerFunc) error {
s.logger.Debugf("Waiting to receive message on topic %s", s.topic)
if err := s.entity.ReceiveOne(ctx, handler); err != nil {
if strings.Contains(err.Error(), "force detached") {
return nil
}

return fmt.Errorf("%s error receiving message on topic %s, %s", errorMessagePrefix, s.topic, err)
return fmt.Errorf("%s error receiving message on topic %s, %w", errorMessagePrefix, s.topic, err)
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Using %w is required to wrap the underlying AMQP error so it can be detected by errors.Is/errors.As.

https://blog.golang.org/go1.13-errors

}

return nil
Expand Down
11 changes: 0 additions & 11 deletions pubsub/nats/metadata.go

This file was deleted.

99 changes: 0 additions & 99 deletions pubsub/nats/nats.go

This file was deleted.

69 changes: 0 additions & 69 deletions pubsub/nats/nats_test.go

This file was deleted.