errors

package
v0.4.16 Latest Latest
Warning

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

Go to latest
Published: Dec 16, 2019 License: Apache-2.0 Imports: 3 Imported by: 3

Documentation

Index

Constants

View Source
const (

	// PanicError will wrap snap panic into an error. Snap will try to handle panic by returning "panic-error" code to the caller.
	// The cause of panic will be logged as error in the snap log.
	PanicError = "panic-error"

	// SystemError ...
	SystemError = "system-error"

	// GeneralError ...
	GeneralError ErrorCode = "general-error"

	// MissingRequiredParameterError is returned when the caller does not provide required parameters for the call
	MissingRequiredParameterError = "missing-required-parameter"

	// ValidationError is usually caused by 'bad' data that is provided by the caller (e.g. invalid URL format)
	ValidationError ErrorCode = "validation-error"

	// InitializeConfigError ...
	InitializeConfigError = "initialize-config-error"

	// InitializeLoggingError ...
	InitializeLoggingError = "initialize-logging-error"

	// MissingConfigDataError ...
	MissingConfigDataError ErrorCode = "missing-config-data-error"

	// InvalidConfigDataError ...
	InvalidConfigDataError ErrorCode = "invalid-config-data-error"

	// CryptoConfigError ...
	CryptoConfigError ErrorCode = "crypto-config-error"

	// CryptoError ...
	CryptoError ErrorCode = "crypto-error"

	// ParseCertError ...
	ParseCertError ErrorCode = "parse-cert-error"

	// ImportKeyError ...
	ImportKeyError ErrorCode = "import-key-error"

	// GetKeyError ...
	GetKeyError ErrorCode = "get-key-error"

	// UnmarshalError ...
	UnmarshalError ErrorCode = "unmarshal-error"

	// InvalidFunctionError ...
	InvalidFunctionError ErrorCode = "invalid-function-error"

	// InitializeSnapError ...
	InitializeSnapError ErrorCode = "initialize-snap-error"

	// PeerConfigError ...
	PeerConfigError = "peer-config-error"

	// ACLCheckError ...
	ACLCheckError = "acl-check-error"

	// MembershipError ... (errors from getAllPeers and getPeersOfChannel)
	MembershipError = "membership-error"

	// InvalidConfigMessage ...
	InvalidConfigMessage = "invalid-config-message"

	// InvalidPeerConfig ...
	InvalidPeerConfig = "invalid-peer-config"

	// InvalidAppConfig ...
	InvalidAppConfig = "invalid-app-config"

	// InvalidComponentConfig ....
	InvalidComponentConfig = "invalid-component-config"

	// InvalidConfigKey ...
	InvalidConfigKey = "invalid-config-key"

	// GetConfigError ...
	GetConfigError = "get-config-error"

	// HTTPClientError ...
	HTTPClientError ErrorCode = "http-client-error"

	// InvalidCertPinError ...
	InvalidCertPinError ErrorCode = "invalid-cert-pin-error"

	// EndorseTxError ...
	EndorseTxError = "endorse-tx-error"

	// CommitTxError ...
	CommitTxError = "commit-tx-error"

	// InvalidCreatorError ...
	InvalidCreatorError = "invalid-creator-error"

	// InvalidSignatureError ...
	InvalidSignatureError = "invalid-signature-error"

	// GetTxServiceError ...
	GetTxServiceError = "get-tx-service-error"

	// TxClientInitError ...
	TxClientInitError = "tx-client-init-error"

	// DataNotFoundError ...
	DataNotFoundError = "data-not-found-error"

	// AccessDeniedError ...
	AccessDeniedError = "access-denied-error"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Error

type Error interface {
	error

	// Status returns the error code
	ErrorCode() ErrorCode
	// Generate log msg
	GenerateLogMsg() string
	// Generate client error msg
	GenerateClientErrorMsg() string
}

Error extends error with additional context

func CreateError

func CreateError(err error, code ErrorCode, msg string) Error

CreateError returns custom error

func Errorf

func Errorf(code ErrorCode, fmt string, args ...interface{}) Error

Errorf returns a new Error

func GetError

func GetError(err error) (Error, bool)

GetError returns custom error

func New

func New(code ErrorCode, msg string) Error

New returns a new Error

func WithMessage

func WithMessage(code ErrorCode, err error, msg string) Error

WithMessage returns a new Error

func Wrap

func Wrap(code ErrorCode, cause error, msg string) Error

Wrap returns a new Error

func Wrapf

func Wrapf(code ErrorCode, cause error, fmt string, args ...interface{}) Error

Wrapf returns a new Error

type ErrorCode

type ErrorCode string

ErrorCode error code

Jump to

Keyboard shortcuts

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