-
Notifications
You must be signed in to change notification settings - Fork 2
/
errors.go
65 lines (50 loc) · 1.06 KB
/
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
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
package queue
import "fmt"
type NoMessagesAvailableError struct {
Code int
Body string
}
func (e NoMessagesAvailableError) Error() string {
return "No messages available within the specified timeout period"
}
type BadRequestError struct {
Code int
Body string
}
func (e BadRequestError) Error() string {
return "Bad createRequest"
}
type NotAuthorizedError struct {
Code int
Body string
}
func (e NotAuthorizedError) Error() string {
return "Authorization failure"
}
type MessageDontExistError struct {
Code int
Body string
}
func (e MessageDontExistError) Error() string {
return "No message was found with the specified MessageId or LockToken."
}
type QueueDontExistError struct {
Code int
Body string
}
func (e QueueDontExistError) Error() string {
return "Specified queue or subscription does not exist"
}
type InternalError struct {
Code int
Body string
}
func (e InternalError) Error() string {
return "Internal Error"
}
func wrap(err error, message string) error {
if err == nil {
return nil
}
return fmt.Errorf(message + ": " + err.Error())
}