forked from Azure/go-amqp
-
Notifications
You must be signed in to change notification settings - Fork 0
/
errors.go
66 lines (55 loc) · 2.4 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
66
package amqp
import (
"fmt"
"time"
"github.com/Azure/go-amqp/internal/encoding"
)
// Error Conditions
const (
// AMQP Errors
ErrorInternalError ErrorCondition = "amqp:internal-error"
ErrorNotFound ErrorCondition = "amqp:not-found"
ErrorUnauthorizedAccess ErrorCondition = "amqp:unauthorized-access"
ErrorDecodeError ErrorCondition = "amqp:decode-error"
ErrorResourceLimitExceeded ErrorCondition = "amqp:resource-limit-exceeded"
ErrorNotAllowed ErrorCondition = "amqp:not-allowed"
ErrorInvalidField ErrorCondition = "amqp:invalid-field"
ErrorNotImplemented ErrorCondition = "amqp:not-implemented"
ErrorResourceLocked ErrorCondition = "amqp:resource-locked"
ErrorPreconditionFailed ErrorCondition = "amqp:precondition-failed"
ErrorResourceDeleted ErrorCondition = "amqp:resource-deleted"
ErrorIllegalState ErrorCondition = "amqp:illegal-state"
ErrorFrameSizeTooSmall ErrorCondition = "amqp:frame-size-too-small"
// Connection Errors
ErrorConnectionForced ErrorCondition = "amqp:connection:forced"
ErrorFramingError ErrorCondition = "amqp:connection:framing-error"
ErrorConnectionRedirect ErrorCondition = "amqp:connection:redirect"
// Session Errors
ErrorWindowViolation ErrorCondition = "amqp:session:window-violation"
ErrorErrantLink ErrorCondition = "amqp:session:errant-link"
ErrorHandleInUse ErrorCondition = "amqp:session:handle-in-use"
ErrorUnattachedHandle ErrorCondition = "amqp:session:unattached-handle"
// Link Errors
ErrorDetachForced ErrorCondition = "amqp:link:detach-forced"
ErrorTransferLimitExceeded ErrorCondition = "amqp:link:transfer-limit-exceeded"
ErrorMessageSizeExceeded ErrorCondition = "amqp:link:message-size-exceeded"
ErrorLinkRedirect ErrorCondition = "amqp:link:redirect"
ErrorStolen ErrorCondition = "amqp:link:stolen"
)
type Error = encoding.Error
type ErrorCondition = encoding.ErrorCondition
// DetachError is returned by a link (Receiver/Sender) when a detach frame is received.
//
// RemoteError will be nil if the link was detached gracefully.
type DetachError struct {
RemoteError *Error
}
func (e *DetachError) Error() string {
return fmt.Sprintf("link detached, reason: %+v", e.RemoteError)
}
// Default link options
const (
DefaultLinkCredit = 1
DefaultLinkBatching = false
DefaultLinkBatchMaxAge = 5 * time.Second
)