File tree Expand file tree Collapse file tree 2 files changed +6
-5
lines changed Expand file tree Collapse file tree 2 files changed +6
-5
lines changed Original file line number Diff line number Diff line change 2626 // ErrTimeout is returned when an applicable queue operation times out.
2727 ErrTimeout = errors .New (`queue: poll timed out` )
2828
29- // ErrUnknown is returned if the error state was unusual and unexpected.
30- ErrUnknown = errors .New (`queue: unknown error` )
29+ // ErrEmptyQueue is returned when an non-applicable queue operation was called
30+ // due to the queue's empty item state
31+ ErrEmptyQueue = errors .New (`queue: empty queue` )
3132)
Original file line number Diff line number Diff line change @@ -260,11 +260,11 @@ func (q *Queue) Peek() (interface{}, error) {
260260 }
261261
262262 peekItem , ok := q .items .peek ()
263- if ok {
264- return peekItem , nil
263+ if ! ok {
264+ return nil , ErrEmptyQueue
265265 }
266266
267- return nil , ErrUnknown
267+ return peekItem , nil
268268}
269269
270270// TakeUntil takes a function and returns a list of items that
You can’t perform that action at this time.
0 commit comments