-
Notifications
You must be signed in to change notification settings - Fork 52
Return BatchDisposition Errors with LockTokenIDs #129
Conversation
batch_disposition.go
Outdated
|
||
// BatchDispositionErrors returns LockTokenIDs with associated error. | ||
BatchDispositionErrors struct { | ||
Errors map[*uuid.UUID] error |
There was a problem hiding this 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 making this implement error? I think it would be nice if this was just a specialized error.
There was a problem hiding this comment.
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.
batch_disposition.go
Outdated
} | ||
|
||
// 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 { |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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?
There was a problem hiding this 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.
There was a problem hiding this 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 {}
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM!
Proposal for #128