Skip to content
This repository has been archived by the owner on Oct 12, 2023. It is now read-only.

Return BatchDisposition Errors with LockTokenIDs #129

Merged
merged 5 commits into from
May 29, 2019
Merged

Return BatchDisposition Errors with LockTokenIDs #129

merged 5 commits into from
May 29, 2019

Conversation

vsaroopchand
Copy link
Contributor

Proposal for #128


// BatchDispositionErrors returns LockTokenIDs with associated error.
BatchDispositionErrors struct {
Errors map[*uuid.UUID] error
Copy link
Member

Choose a reason for hiding this comment

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

What do you think about making this implement error? I think it would be nice if this was just a specialized error.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Good idea 👍 ; I'll fix it.

}

// SendBatchDisposition updates the LockToken id to the desired status.
func (q *Queue) SendBatchDisposition(ctx context.Context, iterator BatchDispositionIterator) error {
func (q *Queue) SendBatchDisposition(ctx context.Context, iterator BatchDispositionIterator) *BatchDispositionErrors {
Copy link
Member

@devigned devigned Apr 30, 2019

Choose a reason for hiding this comment

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

I'm teetering back and for on returning an error and specializing the error as described above. On one hand, BatchDispotionsErrors is more specific, but on the other, it seems a little odd to return an error in that shape. Thoughts?

Copy link
Contributor Author

@vsaroopchand vsaroopchand Apr 30, 2019

Choose a reason for hiding this comment

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

I agree, tough call. I do like the custom error type (see latest changeset) - but also seems odd. Maybe OnError, OnSuccess handlers on BatchDispositionIterator?

@devigned devigned self-requested a review May 29, 2019 17:57
Copy link
Member

@devigned devigned left a comment

Choose a reason for hiding this comment

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

Looks good to me! Please rebase the PR with the latest changes in master and let's get this pulled in.

Please disregard.

@devigned devigned self-requested a review May 29, 2019 18:01
Copy link
Member

@devigned devigned left a comment

Choose a reason for hiding this comment

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

What do you think about changing the signatures to the following pattern?

func (q *Queue) SendBatchDisposition(ctx context.Context, iterator BatchDispositionIterator) error

Where the error returned is:

type BatchDispositionError struct {
			Errors []DispositionError
}

type DispositionError struct {
			LockTokenID *uuid.UUID
			err         error
}

func (bde BatchDispositionError) Error() string {}

func (de DispositionError) Error() string {}

Copy link
Member

@devigned devigned left a comment

Choose a reason for hiding this comment

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

LGTM!

@devigned devigned merged commit 38b3b33 into Azure:master May 29, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants