-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy patherror.go
97 lines (76 loc) · 3.33 KB
/
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
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
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
package dynamomq
import "fmt"
// IDNotProvidedError represents an error when an ID is not provided where it is required.
type IDNotProvidedError struct{}
// Error returns a standard error message for IDNotProvidedError.
func (e IDNotProvidedError) Error() string {
return "ID was not provided."
}
// IDNotFoundError represents an error when a provided ID is not found in DynamoDB.
type IDNotFoundError struct{}
// Error returns a standard error message for IDNotFoundError.
func (e IDNotFoundError) Error() string {
return "Provided ID was not found in the Dynamo DB."
}
// IDDuplicatedError represents an error when a provided ID is duplicated in the system.
type IDDuplicatedError struct{}
// Error returns a standard error message for IDDuplicatedError.
func (e IDDuplicatedError) Error() string {
return "Provided ID was duplicated."
}
// ConditionalCheckFailedError represents an error when a condition check on the 'version' attribute fails.
type ConditionalCheckFailedError struct {
Cause error
}
// Error returns a detailed error message including the underlying cause for ConditionalCheckFailedError.
func (e ConditionalCheckFailedError) Error() string {
return fmt.Sprintf("Condition on the 'version' attribute has failed: %v.", e.Cause)
}
// BuildingExpressionError represents an error during the building of a DynamoDB expression.
type BuildingExpressionError struct {
Cause error
}
// Error returns a detailed error message including the underlying cause for BuildingExpressionError.
func (e BuildingExpressionError) Error() string {
return fmt.Sprintf("Failed to build expression: %v.", e.Cause)
}
// DynamoDBAPIError represents a generic error encountered when making a DynamoDB API call.
type DynamoDBAPIError struct {
Cause error
}
// Error returns a detailed error message including the underlying cause for DynamoDBAPIError.
func (e DynamoDBAPIError) Error() string {
return fmt.Sprintf("Failed DynamoDB API: %v.", e.Cause)
}
// UnmarshalingAttributeError represents an error during the unmarshaling of DynamoDB attributes.
type UnmarshalingAttributeError struct {
Cause error
}
// Error returns a detailed error message including the underlying cause for UnmarshalingAttributeError.
func (e UnmarshalingAttributeError) Error() string {
return fmt.Sprintf("Failed to unmarshal: %v.", e.Cause)
}
// MarshalingAttributeError represents an error during the marshaling of DynamoDB attributes.
type MarshalingAttributeError struct {
Cause error
}
// Error returns a detailed error message including the underlying cause for MarshalingAttributeError.
func (e MarshalingAttributeError) Error() string {
return fmt.Sprintf("Failed to marshal: %v.", e.Cause)
}
// EmptyQueueError represents an error when an operation cannot proceed due to an empty queue.
type EmptyQueueError struct{}
// Error returns a standard error message for EmptyQueueError.
func (e EmptyQueueError) Error() string {
return "Cannot proceed, queue is empty."
}
// InvalidStateTransitionError represents an error for invalid state transitions during operations.
type InvalidStateTransitionError struct {
Msg string
Operation string
Current Status
}
// Error returns a detailed error message explaining the invalid state transition.
func (e InvalidStateTransitionError) Error() string {
return fmt.Sprintf("operation %s failed for status %s: %s.", e.Operation, e.Current, e.Msg)
}