service_errors

package
v0.0.0-...-eac6ddc Latest Latest
Warning

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

Go to latest
Published: Nov 5, 2021 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrMisconfiguredAccountParameters           = errors.New("misconfigured merchant account parameters")
	ErrMisconfiguredIds                         = errors.New("misconfigured merchant account id")
	ErrFailedToConnectToDatabase                = errors.New("failed to connect to database")
	ErrFailedToPerformDatabaseMigrations        = errors.New("failed to perform database migrations")
	ErrInvalidInputArguments                    = errors.New("invalid input arguments")
	ErrInvalidEnvironmentVariableConfigurations = errors.New("invalid environment variable configurations")
	ErrFailedToStartGRPCServer                  = errors.New("failed to start grpc server")
	ErrHttpServerFailedGracefuleShutdown        = errors.New("http server failed to perform graceful shutdown")
	ErrHttpsServerFailedGracefuleShutdown       = errors.New("https server failed to perform graceful shutdown")
	ErrHttpServerCrashed                        = errors.New("Http Server crashed")
	ErrHttpsServerCrashed                       = errors.New("Https Server crashed")
	ErrSwaggerGenError                          = errors.New("swagger generation error")
	ErrFailedToWatchConfigDirectory             = errors.New("failed to watch config directory")
	ErrExceededMaxRetryAttempts                 = errors.New("exceeded max retry attemps")
	ErrInvalidAccount                           = errors.New("invalid account. account contains invalid fields")
	ErrFailedToReactivateAccount                = errors.New("failed to reactivate existing account")
	ErrDistributedTransactionError              = errors.New("distributed transaction error. failed to successfully perform a distributed operations")
	ErrFailedToUpdateAccountActiveStatus        = errors.New("failed to updated account active status")
	ErrAccountDoesNotExist                      = errors.New("account does not exist")
	ErrAccountExistButInactive                  = errors.New("account exists but is inactive")
	ErrAccountAlreadyExist                      = errors.New("account already exists")
	ErrFailedToConvertFromOrmType               = errors.New("failed to perform conversion from Orm type")
	ErrFailedToConvertToOrmType                 = errors.New("failed to perform conversion to Orm type")
	ErrFailedToConfigureSaga                    = errors.New("failed to configure saga")
	ErrSagaFailedToExecuteSuccessfully          = errors.New("saga failed to execute successfully")
	ErrFailedToHashPassword                     = errors.New("failed to hash password")
	ErrFailedToCreateAccount                    = errors.New("failed to create account")
	ErrFailedToDeleteBusinessAccount            = errors.New("failed to delete business account")
	ErrFailedToUpdateAccountEmail               = errors.New("failed to updated business account email through distributed transaction")
	ErrFailedToSaveUpdatedAccountRecord         = errors.New("failed to save updated business account record")
	ErrCannotUpdatePassword                     = errors.New("cannot update password field")
	ErrCannotConfigureAccount                   = errors.New("cannot configure account")
	ErrFailedToCastToType                       = errors.New("failed to cast to tx result to type after tx completion")
	ErrUnableToObtainBusinessAccounts           = errors.New("unable to obtain business accounts")
	ErrUnauthorizedRequest                      = errors.New("unauthorized request")
	ErrFailedToCreateAccountInAuthHdlrSvc       = errors.New("failed to create an account in authentication handler service")
	ErrAccountAlreadyActive                     = errors.New("account exists and is already active")
)

Functions

func ConcatenateErrorMessages

func ConcatenateErrorMessages(msg1, msg2 string) error

ConcatenateErrorMessages concatenates error messages

func NewError

func NewError(msg string) error

NewError transforms a set of text into a usable error object

Types

type APIConnectionError

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

APIConnectionError is a failure to connect to the Merchant Account Service API.

func (*APIConnectionError) Error

func (e *APIConnectionError) Error() string

Error serializes the error object to JSON and returns it as a string.

type APIError

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

APIError is a catch all for any errors not covered by other types (and should be extremely uncommon).

func (*APIError) Error

func (e *APIError) Error() string

Error serializes the error object to JSON and returns it as a string.

type AuthenticationError

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

AuthenticationError is a failure to properly authenticate during a request.

func (*AuthenticationError) Error

func (e *AuthenticationError) Error() string

Error serializes the error object to JSON and returns it as a string.

type DatabaseError

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

DatabaseError occurs in the face of errors due faulty database operations

func (*DatabaseError) Error

func (e *DatabaseError) Error() string

Error serializes the error object to JSON and returns it as a string.

type DistributedTxError

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

DistributedTxError results when an error occurs when performing a distributed tx.

func (*DistributedTxError) Error

func (e *DistributedTxError) Error() string

Error serializes the error object to JSON and returns it as a string.

type ErrorCode

type ErrorCode string

ErrorCode is the list of allowed values for the error's code.

const (
	ErrorCodeAccountAlreadyExists           ErrorCode = "account_already_exists"
	ErrorCodeMisconfiguredMerchantAccountID ErrorCode = "misconfigured_merchant_account_id"
	ErrorCodeAccountInvalid                 ErrorCode = "account_invalid"
	ErrorCodeMisconfiguredAccountParameters ErrorCode = "misconfigured_merchant_account_parameters"
	ErrorCodeDatabaseConnectionFailure      ErrorCode = "database_connection_failure"
	ErrorCodeDatabaseMigrationFailure       ErrorCode = "database_migration_failure"
	ErrorCodeInvalidInput                   ErrorCode = "invalid_input"
	ErrorCodeInvalidEnvironmentVariables    ErrorCode = "invalid_environment_variables"
	ErrorCodeAuthenticationRequired         ErrorCode = "authentication_required"
)

List of values that ErrorCode can take.

type ErrorType

type ErrorType string

ErrorType is the list of allowed values for the error's type.

const (
	ErrorTypeAPI            ErrorType = "api_error"
	ErrorTypeAPIConnection  ErrorType = "api_connection_error"
	ErrorTypeAuthentication ErrorType = "authentication_error"
	ErrorTypeDistributedTx  ErrorType = "distributed_tx_error"
	ErrorTypeInvalidRequest ErrorType = "invalid_request_error"
	ErrorTypePermission     ErrorType = "more_permissions_required"
	ErrorTypeRateLimit      ErrorType = "rate_limit_error"
	ErrorTypeParameters     ErrorType = "parameter_configuration_error"
)

List of values that ErrorType can take.

type InvalidRequestError

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

InvalidRequestError results when an error occurs due to an invalid request being performed against this service

func (*InvalidRequestError) Error

func (e *InvalidRequestError) Error() string

Error serializes the error object to JSON and returns it as a string.

type PermissionError

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

PermissionError results when you attempt to make an API request for which your account doesn't have the right permissions.

func (*PermissionError) Error

func (e *PermissionError) Error() string

Error serializes the error object to JSON and returns it as a string.

type RatelimitError

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

RatelimitError occurs in the face of errors due to rate limiting

func (*RatelimitError) Error

func (e *RatelimitError) Error() string

Error serializes the error object to JSON and returns it as a string.

type ServiceError

type ServiceError struct {
	Code ErrorCode `json:"code,omitempty"`

	// Err contains an internal error with an additional level of granularity
	// that can be used in some cases to get more detailed information about
	// what went wrong. For example, Err may hold a TxError that indicates
	// exactly what went wrong during distributed tx.
	Err error `json:"-"`

	HTTPStatusCode int       `json:"status,omitempty"`
	Msg            string    `json:"message"`
	Param          string    `json:"param,omitempty"`
	RequestID      string    `json:"request_id,omitempty"`
	Type           ErrorType `json:"type"`
}

ServiceError is the response returned when a call is unsuccessful.

func NewServiceError

func NewServiceError(code ErrorCode, err error, statusCode int, msg, param, requestId string, errType ErrorType) ServiceError

NewServiceError creates a new instance of the service error

func (*ServiceError) Error

func (e *ServiceError) Error() string

Error serializes the error object to JSON and returns it as a string.

Jump to

Keyboard shortcuts

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