Documentation ¶
Overview ¶
Package uerr is the error definition of service and sdk
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ( // ErrInvalidRequest is the error for invalid request took from user ErrInvalidRequest = "client.InvalidRequestError" // ErrSendRequest is the error for sending request ErrSendRequest = "client.SendRequestError" // ErrNetwork is the error for any network error caused by client or server network environment // ErrNetwork can be caused by net errors of golang // ErrNetwork is retryable ErrNetwork = "client.NetworkError" // ErrUnexpected is the error for any unexpected error ErrUnexpected = "client.UnexpectedError" ErrCredentialExpired = "client.CredentialExpiredError" ErrNullCredential = "client.NullCredentialError" ErrNullConfig = "client.NullConfigError" )
var ( // ErrHTTPStatus is error type of http status ErrHTTPStatus = "server.HTTPStatusError" // ErrRetCode is error type of server return code is larger than 0 ErrRetCode = "server.RetCodeError" // ErrResponseBodyError is error type of server response body ErrResponseBodyError = "server.ResponseBodyError" // ErrEmptyResponseBodyError is empty of server response body ErrEmptyResponseBodyError = "server.EmptyResponseBodyError" )
Functions ¶
func IsCodeError ¶
IsCodeError will check if the error is the retuen code error
func IsNetworkError ¶
IsNetworkError will check if the error raise from network problem
Types ¶
type ClientError ¶
type ClientError struct {
// contains filtered or unexported fields
}
ClientError is the ucloud common errorfor server response
func NewClientError ¶
func NewClientError(name string, err error) ClientError
NewClientError will return a new instance of ClientError
func (ClientError) Error ¶
func (e ClientError) Error() string
func (ClientError) OriginError ¶
func (e ClientError) OriginError() error
OriginError will return the origin error that caused by
func (ClientError) Retryable ¶
func (e ClientError) Retryable() bool
Retryable will return if the error is retryable
func (ClientError) StatusCode ¶
func (e ClientError) StatusCode() int
StatusCode will return http status code
type Error ¶
type Error interface { error // name, should be client.xxx or server.xxx Name() string // retcode for server api error, retcode > 0 will cause an error Code() int // http status code, code >= 400 will case an error StatusCode() int // message for server api error Message() string // the origin error that sdk error caused from OriginError() error // if the error is retryable Retryable() bool }
Error is the ucloud sdk error
func NewNonRetryableError ¶
NewNonRetryableError will wrap any error as a non-retryable error
func NewRetryableError ¶
NewRetryableError will wrap any error as a retryable error
type ServerError ¶
type ServerError struct {
// contains filtered or unexported fields
}
ServerError is the ucloud common error for server response
func NewEmptyResponseBodyError ¶ added in v0.16.5
func NewEmptyResponseBodyError() ServerError
NewEmptyResponseBodyError will create a new response body error
func NewResponseBodyError ¶ added in v0.16.5
func NewResponseBodyError(err error, body string) ServerError
NewResponseBodyError will create a new response body error
func NewServerCodeError ¶
func NewServerCodeError(retCode int, message string) ServerError
NewServerCodeError will return a new instance of NewServerStatusError
func NewServerStatusError ¶
func NewServerStatusError(statusCode int, message string) ServerError
NewServerStatusError will return a new instance of NewServerStatusError
func (ServerError) Error ¶
func (e ServerError) Error() string
func (ServerError) OriginError ¶
func (e ServerError) OriginError() error
OriginError will return the origin error that caused by
func (ServerError) Retryable ¶
func (e ServerError) Retryable() bool
Retryable will return if the error is retryable
func (ServerError) StatusCode ¶
func (e ServerError) StatusCode() int
StatusCode will return http status code