-
Notifications
You must be signed in to change notification settings - Fork 0
/
errors.go
44 lines (32 loc) · 862 Bytes
/
errors.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
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
package posixmq
import (
"fmt"
"strings"
)
//TimedOutError is the error returned by mqsend because of the queue was full.
type TimedOutError struct {
Cause error
}
func (e TimedOutError) Error() string {
return fmt.Sprintf("mqsend: send timed out: %v", e.Cause)
}
// Unwrap returns the underlying error.
func (e TimedOutError) Unwrap() error {
return e.Cause
}
// MessageTooLargeError is the error returned by MessageQueue.Send when the
// message is larger than the configured max size.
type MessageTooLongError struct {
MessageSize int
// Note that on non-linux systems Cause will be nil.
Cause error
}
func (e MessageTooLongError) Error() string {
var sb strings.Builder
sb.WriteString(e.Cause.Error())
return sb.String()
}
// Unwrap returns the underlying error, if any.
func (e MessageTooLongError) Unwrap() error {
return e.Cause
}