diff --git a/queue/bytes_queue.go b/queue/bytes_queue.go index c4fe2c08..9f2379d7 100644 --- a/queue/bytes_queue.go +++ b/queue/bytes_queue.go @@ -17,6 +17,7 @@ var ( errEmptyQueue = &queueError{"Empty queue"} errInvalidIndex = &queueError{"Index must be greater than zero. Invalid index."} errIndexOutOfBounds = &queueError{"Index out of range"} + errFullQueue = &queueError{"Full queue. Maximum size limit reached."} ) // BytesQueue is a non-thread safe queue type of fifo based on bytes array. @@ -92,7 +93,7 @@ func (q *BytesQueue) Push(data []byte) (int, error) { if q.canInsertBeforeHead(neededSize) { q.tail = leftMarginIndex } else if q.capacity+neededSize >= q.maxCapacity && q.maxCapacity > 0 { - return -1, &queueError{"Full queue. Maximum size limit reached."} + return -1, errFullQueue } else { q.allocateAdditionalMemory(neededSize) }