Skip to content
Closed
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
7 changes: 7 additions & 0 deletions sdk/messaging/azservicebus/internal/errors.go
Original file line number Diff line number Diff line change
Expand Up @@ -158,6 +158,13 @@ func isRetryableAMQPError(ctxForLogging context.Context, err error) bool {
return ok
}

var amqpDetachErr *amqp.DetachError
var isAMQPDetachError = errors.As(err, &amqpDetachErr)

if isAMQPDetachError {
return isRetryableAMQPError(ctxForLogging, amqpDetachErr.RemoteError)
}

// TODO: there is a bug somewhere that seems to be errorString'ing errors. Need to track that down.
// In the meantime, try string matching instead
for condition := range retryableAMQPConditions {
Expand Down
5 changes: 5 additions & 0 deletions sdk/messaging/azservicebus/internal/errors_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,11 @@ func Test_isRetryableAMQPError(t *testing.T) {
require.True(t, isRetryableAMQPError(ctx, &amqp.Error{
Condition: amqp.ErrorCondition(code),
}))
require.True(t, isRetryableAMQPError(ctx, &amqp.DetachError{
RemoteError: &amqp.Error{
Condition: amqp.ErrorCondition(code),
},
}))

// it works equally well if the error is just in the String().
// Need to narrow this down some more to see where the errors
Expand Down