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 26
26
// ErrTimeout is returned when an applicable queue operation times out.
27
27
ErrTimeout = errors .New (`queue: poll timed out` )
28
28
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` )
31
32
)
Original file line number Diff line number Diff line change @@ -260,11 +260,11 @@ func (q *Queue) Peek() (interface{}, error) {
260
260
}
261
261
262
262
peekItem , ok := q .items .peek ()
263
- if ok {
264
- return peekItem , nil
263
+ if ! ok {
264
+ return nil , ErrEmptyQueue
265
265
}
266
266
267
- return nil , ErrUnknown
267
+ return peekItem , nil
268
268
}
269
269
270
270
// TakeUntil takes a function and returns a list of items that
You can’t perform that action at this time.
0 commit comments