From b276a3c7ab2b1b479348e0cb4addb523421a82dc Mon Sep 17 00:00:00 2001 From: Arijit Das Date: Tue, 2 Nov 2021 07:33:20 +0530 Subject: [PATCH] Add error errRangeDoesNotExist. --- pkg/api_test.go | 2 +- pkg/range_queue.go | 5 +++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/pkg/api_test.go b/pkg/api_test.go index 930b71d..352ad70 100644 --- a/pkg/api_test.go +++ b/pkg/api_test.go @@ -69,7 +69,7 @@ func TestRemoveRange(t *testing.T) { name: "invalid block range range", start: 0, stop: 5, - expected: errEmptyQueue, + expected: errRangeDoesNotExist, }, { name: "valid block range", diff --git a/pkg/range_queue.go b/pkg/range_queue.go index f064e69..8d2ba36 100644 --- a/pkg/range_queue.go +++ b/pkg/range_queue.go @@ -6,7 +6,8 @@ import ( ) var ( - errEmptyQueue = errors.New("queue is empty") + errEmptyQueue = errors.New("queue is empty") + errRangeDoesNotExist = errors.New("range does not exist in queue") ) type blockRangeQueue struct { @@ -38,7 +39,7 @@ func (q *blockRangeQueue) search(rngReq RangeRequest) (int, error) { } } - return 0, errEmptyQueue + return 0, errRangeDoesNotExist } func (q *blockRangeQueue) get() []RangeRequest {