cfnerr

package
v0.1.2 Latest Latest
Warning

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

Go to latest
Published: Dec 4, 2019 License: Apache-2.0 Imports: 2 Imported by: 0

Documentation

Overview

Package cfnerr defines a custom error type used by the RPDK Go plugin.

Index

Constants

View Source
const (
	// Unknown ...
	UnknownError = "UNKNOWN"

	// NotUpdatable is when the customer tried perform an update to a property that is CreateOnly. Only
	// applicable to Update Handler. (Terminal)
	NotUpdatable = "NOTUPDATABLE"

	// InvalidRequest is a generic exception caused by invalid input from the customer. (Terminal)
	InvalidRequest = "INVALIDREQUEST"

	//AccessDenied is when the customer has insufficient permissions to perform this action. (Terminal)
	AccessDenied = "ACCESSDENIED"

	//InvalidCredentials is when the customer's provided credentials were invalid. (Terminal)
	InvalidCredentials = "INVALIDCREDENTIALS"

	//AlreadyExists is when the specified resource already existed prior to the execution of the handler.
	//Only applicable to Create Handler (Terminal) Handlers MUST return this error
	//when duplicate creation requests are received.
	AlreadyExists = "ALREADYEXISTS"

	//NotFound is when the specified resource does not exist, or is in a terminal, inoperable, and
	//irrecoverable state. (Terminal)
	NotFound = "NOTFOUND"

	//ResourceConflict is when the resource is temporarily unable to be acted upon; for example, if the
	//resource is currently undergoing an operation and cannot be acted upon until
	//that operation is finished (Retriable)
	ResourceConflict = "RESOURCECONFLICT"

	//Throttling is when the request was throttled by the downstream service. (Retriable)
	Throttling = "THROTTLING"

	//ServiceLimitExceeded is when a non-transient resource limit was reached on the service side. (Terminal)
	ServiceLimitExceeded = "SERVICELIMITEXCEEDED"

	//NotStabilized is when the downstream resource failed to complete all of its ready state checks.
	//(Retriable)
	NotStabilized = "NOTSTABILIZED"

	//GeneralServiceException is an exception from the downstream service that does not map to any other error
	//codes. (Terminal)
	GeneralServiceException = "GENERALSERVICEEXCEPTION"

	//ServiceInternalis when the downstream service returned an internal error, typically with a 5XX HTTP
	//code. (Retriable)
	ServiceInternalError = "SERVICEINTERNALERROR"

	//NetworkFailure is when the request was unable to be completed due to networking issues, such as
	//failure to receive a response from the server. (Retriable)
	NetworkFailure = "NETWORKFAILURE"

	// InternalFailure is an unexpected error occurred within the handler, such as an NPE, etc.
	//(Terminal)
	InternalFailure = "INTERNALFAILURE"
)

Variables

This section is empty.

Functions

func Sprint

func Sprint(code, message, extra string, origErr error) string

Sprint returns a string of the formatted error code.

Both extra and origErr are optional. If they are included their lines will be added, but if they are not included their lines will be ignored.

Types

type BatchedErrors

type BatchedErrors interface {
	error

	// Returns all original errors
	OrigErrs() []error
}

BatchedErrors is a batch of errors which also wraps lower level errors with code, message, and original errors. Calling Error() will include all errors that occurred in the batch.

func NewBatchError

func NewBatchError(code string, message string, origErrs []error) BatchedErrors

NewBatchError groups one or more errors together for processing

type Error

type Error interface {
	// inherit the base error interface
	error

	// Returns an error code
	Code() string

	// Returns the error message
	Message() string

	// Returns the original error
	OrigErr() error
}

An Error wraps lower level errors with code, message and an original error. The underlying concrete error type may also satisfy other interfaces which can be to used to obtain more specific information about the error.

Calling Error() or String() will always include the full information about an error based on its underlying type.

func New

func New(code string, message string, origErr error) Error

New base error

Jump to

Keyboard shortcuts

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