Documentation
¶
Overview ¶
Package errors/check.go
Package errors/codes.go
Package errors/errors.go
Index ¶
- func IsAccessDenied(err error) bool
- func IsBucketExists(err error) bool
- func IsBucketNotEmpty(err error) bool
- func IsBucketNotFound(err error) bool
- func IsInvalidArgument(err error) bool
- func IsNotFound(err error) bool
- func IsObjectNotFound(err error) bool
- func IsRetryable(err error) bool
- func IsServiceUnavailable(err error) bool
- func ParseErrorResponse(resp *http.Response, bucketName, objectName string) error
- type APIError
- func (e *APIError) Code() RustfsGoErrorCode
- func (e *APIError) Error() string
- func (e *APIError) Message() string
- func (e *APIError) RequestID() string
- func (e *APIError) Resource() string
- func (e *APIError) StatusCode() int
- func (e *APIError) WithRegion(region string) *APIError
- func (e *APIError) WithRequestID(id string) *APIError
- func (e *APIError) WithResource(resource string) *APIError
- type Error
- type RustfsGoErrorCode
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func IsBucketExists ¶
IsBucketExists checks if the bucket already exists
func IsBucketNotEmpty ¶
IsBucketNotEmpty checks if the bucket is not empty
func IsBucketNotFound ¶
IsBucketNotFound checks if the bucket does not exist
func IsInvalidArgument ¶
IsInvalidArgument checks if the error is due to an invalid argument
func IsNotFound ¶
IsNotFound checks if the error indicates that a resource was not found
func IsObjectNotFound ¶
IsObjectNotFound checks if the object does not exist
func IsServiceUnavailable ¶
IsServiceUnavailable checks if the service is unavailable
Types ¶
type APIError ¶
type APIError struct {
XMLName xml.Name `xml:"Error"`
ErrorCode string `xml:"Code"`
ErrorMessage string `xml:"Message"`
ErrorResource string `xml:"Resource"`
ErrorRequestID string `xml:"RequestId"`
HostID string `xml:"HostId"`
ErrorStatusCode int `xml:"-"`
Region string `xml:"Region"`
}
APIError S3 API error
func NewAPIError ¶
func NewAPIError(code RustfsGoErrorCode, message string, statusCode int) *APIError
NewAPIError creates a new APIError
func ToAPIError ¶
ToAPIError converts a generic error to an APIError if possible
func (*APIError) StatusCode ¶
StatusCode returns the HTTP status code
func (*APIError) WithRegion ¶
WithRegion sets the region
func (*APIError) WithRequestID ¶
WithRequestID sets the request ID
func (*APIError) WithResource ¶
WithResource sets the resource
type Error ¶
type Error interface {
error
Code() RustfsGoErrorCode
Message() string
StatusCode() int
RequestID() string
Resource() string
}
Error RustFSGo error interface
type RustfsGoErrorCode ¶
type RustfsGoErrorCode string
RustfsGoErrorCode defines RustfsGo error codes
const ( // bucket ErrCodeNoSuchBucket RustfsGoErrorCode = "NoSuchBucket" ErrCodeBucketAlreadyExists RustfsGoErrorCode = "BucketAlreadyExists" ErrCodeBucketAlreadyOwnedByYou RustfsGoErrorCode = "BucketAlreadyOwnedByYou" ErrCodeBucketNotEmpty RustfsGoErrorCode = "BucketNotEmpty" ErrCodeInvalidBucketName RustfsGoErrorCode = "InvalidBucketName" // object ErrCodeNoSuchKey RustfsGoErrorCode = "NoSuchKey" ErrCodeInvalidObjectName RustfsGoErrorCode = "XRustfsInvalidObjectName" ErrCodeNoSuchUpload RustfsGoErrorCode = "NoSuchUpload" ErrCodeNoSuchVersion RustfsGoErrorCode = "NoSuchVersion" ErrCodeInvalidPart RustfsGoErrorCode = "InvalidPart" ErrCodeInvalidPartOrder RustfsGoErrorCode = "InvalidPartOrder" ErrCodeEntityTooLarge RustfsGoErrorCode = "EntityTooLarge" ErrCodeEntityTooSmall RustfsGoErrorCode = "EntityTooSmall" // access ErrCodeAccessDenied RustfsGoErrorCode = "AccessDenied" ErrCodeAccountProblem RustfsGoErrorCode = "AccountProblem" ErrCodeInvalidAccessKeyId RustfsGoErrorCode = "InvalidAccessKeyId" ErrCodeSignatureDoesNotMatch RustfsGoErrorCode = "SignatureDoesNotMatch" // request ErrCodeInvalidArgument RustfsGoErrorCode = "InvalidArgument" ErrCodeInvalidRequest RustfsGoErrorCode = "InvalidRequest" ErrCodeMalformedXML RustfsGoErrorCode = "MalformedXML" ErrCodeMissingContentLength RustfsGoErrorCode = "MissingContentLength" ErrCodeMethodNotAllowed RustfsGoErrorCode = "MethodNotAllowed" ErrNilResponse RustfsGoErrorCode = "NilResponse" ErrRequestTimeout RustfsGoErrorCode = "RequestTimeout" ErrRequestTimeTooSkewed RustfsGoErrorCode = "RequestTimeTooSkewed" ErrMovedPermanently RustfsGoErrorCode = "MovedPermanently" ErrConflict RustfsGoErrorCode = "Conflict" ErrInvalidRange RustfsGoErrorCode = "InvalidRange" // region and authorization ErrCodeInvalidRegion RustfsGoErrorCode = "InvalidRegion" ErrCodeAuthorizationHeaderMalformed RustfsGoErrorCode = "AuthorizationHeaderMalformed" // server ErrCodeInternalError RustfsGoErrorCode = "InternalError" ErrCodeSlowDown RustfsGoErrorCode = "SlowDown" ErrCodeNotImplemented RustfsGoErrorCode = "NotImplemented" // preconditions ErrCodePreconditionFailed RustfsGoErrorCode = "PreconditionFailed" ErrCodeNotModified RustfsGoErrorCode = "NotModified" // copy ErrCodeInvalidCopySource RustfsGoErrorCode = "InvalidCopySource" )
S3 standard error codes
func (RustfsGoErrorCode) Error ¶
func (e RustfsGoErrorCode) Error() string
Error implements the error interface for RustfsGoErrorCode