-
Notifications
You must be signed in to change notification settings - Fork 32
/
error.go
29 lines (24 loc) · 629 Bytes
/
error.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
package goconcurrentqueue
const (
QueueErrorCodeEmptyQueue = "empty-queue"
QueueErrorCodeLockedQueue = "locked-queue"
QueueErrorCodeIndexOutOfBounds = "index-out-of-bounds"
QueueErrorCodeFullCapacity = "full-capacity"
QueueErrorCodeInternalChannelClosed = "internal-channel-closed"
)
type QueueError struct {
code string
message string
}
func NewQueueError(code string, message string) *QueueError {
return &QueueError{
code: code,
message: message,
}
}
func (st *QueueError) Error() string {
return st.message
}
func (st *QueueError) Code() string {
return st.code
}