errors

package
v0.0.0-...-2e770b4 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 21, 2024 License: Apache-2.0 Imports: 4 Imported by: 18

Documentation

Index

Constants

View Source
const (
	DefaultClientErrorStatus = 400
	DefaultClientErrorCode   = "SDK.ClientError"

	UnsupportedCredentialErrorCode    = "SDK.UnsupportedCredential"
	UnsupportedCredentialErrorMessage = "Specified credential (type = %s) is not supported, please check"

	CanNotResolveEndpointErrorCode    = "SDK.CanNotResolveEndpoint"
	CanNotResolveEndpointErrorMessage = "Can not resolve endpoint(param = %s), please check your accessKey with secret, and read the user guide\n %s"

	UnsupportedParamPositionErrorCode    = "SDK.UnsupportedParamPosition"
	UnsupportedParamPositionErrorMessage = "Specified param position (%s) is not supported, please upgrade sdk and retry"

	AsyncFunctionNotEnabledCode    = "SDK.AsyncFunctionNotEnabled"
	AsyncFunctionNotEnabledMessage = "Async function is not enabled in client, please invoke 'client.EnableAsync' function"

	UnknownRequestTypeErrorCode    = "SDK.UnknownRequestType"
	UnknownRequestTypeErrorMessage = "Unknown Request Type: %s"

	MissingParamErrorCode = "SDK.MissingParam"
	InvalidParamErrorCode = "SDK.InvalidParam"

	JsonUnmarshalErrorCode    = "SDK.JsonUnmarshalError"
	JsonUnmarshalErrorMessage = "Failed to unmarshal response, but you can get the data via response.GetHttpStatusCode() and response.GetHttpContentString()"

	TimeoutErrorCode    = "SDK.TimeoutError"
	TimeoutErrorMessage = "The request timed out %s times(%s for retry), perhaps we should have the threshold raised a little?"
)

const code and msg

View Source
const (
	SignatureDostNotMatchErrorCode = "SignatureDoesNotMatch"
	MessagePrefix                  = "Specified signature is not matched with our calculation. server string to sign is:"
)

const code and msg prefix

Variables

This section is empty.

Functions

This section is empty.

Types

type ClientError

type ClientError struct {
	// contains filtered or unexported fields
}

ClientError wrap error

func (*ClientError) Error

func (err *ClientError) Error() string

Error returns clientErrMsg

func (*ClientError) ErrorCode

func (err *ClientError) ErrorCode() string

ErrorCode returns error code

func (*ClientError) HttpStatus

func (*ClientError) HttpStatus() int

HttpStatus returns DefaultClientErrorStatus

func (*ClientError) Message

func (err *ClientError) Message() string

Message returns error message

func (*ClientError) OriginError

func (err *ClientError) OriginError() error

OriginError returns originError

func (*ClientError) String

func (err *ClientError) String() string

String returns error string

type Error

type Error interface {
	error
	HttpStatus() int
	ErrorCode() string
	Message() string
	OriginError() error
}

Error wrap error interface

func NewClientError

func NewClientError(errorCode, message string, originErr error) Error

NewClientError returns Error

func NewServerError

func NewServerError(httpStatus int, responseContent, comment string) Error

NewServerError returns server error

type ServerError

type ServerError struct {
	// contains filtered or unexported fields
}

ServerError wrap error

func WrapServerError

func WrapServerError(originError *ServerError, wrapInfo map[string]string) *ServerError

WrapServerError returns ServerError

func (*ServerError) Comment

func (err *ServerError) Comment() string

Comment returns error's comment

func (*ServerError) Error

func (err *ServerError) Error() string

Error returns error msg

func (*ServerError) ErrorCode

func (err *ServerError) ErrorCode() string

ErrorCode returns error code

func (*ServerError) HostId

func (err *ServerError) HostId() string

HostId returns host id

func (*ServerError) HttpStatus

func (err *ServerError) HttpStatus() int

HttpStatus returns http status

func (*ServerError) Message

func (err *ServerError) Message() string

Message returns message

func (*ServerError) OriginError

func (err *ServerError) OriginError() error

OriginError returns nil

func (*ServerError) Recommend

func (err *ServerError) Recommend() string

Recommend returns error's recommend

func (*ServerError) RequestId

func (err *ServerError) RequestId() string

RequestId returns request id

type ServerErrorWrapper

type ServerErrorWrapper interface {
	// contains filtered or unexported methods
}

ServerErrorWrapper provides tryWrap func

type SignatureDostNotMatchWrapper

type SignatureDostNotMatchWrapper struct{}

SignatureDostNotMatchWrapper implements tryWrap interface

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL