errors

package
v0.0.13 Latest Latest
Warning

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

Go to latest
Published: Oct 2, 2023 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ENV_VAR           = ErrorContextKey("EnvVar")
	VALUE             = ErrorContextKey("Value")
	DB_ADMIN_USERNAME = ErrorContextKey("dbAdminUsername")
	DB_HOST           = ErrorContextKey("dbHost")
	DB_NAME           = ErrorContextKey("dbName")
	DB_PORT           = ErrorContextKey("dbPort")
	DB_USERNAME       = ErrorContextKey("dbUsername")
	PORT_NUMBER       = ErrorContextKey("PortNumber")
	SQL_STMT          = ErrorContextKey("SqlStmt")
	SSL_MODE          = ErrorContextKey("sslMode")
	TABLE_NAME        = ErrorContextKey("TableName")
	TYPE              = ErrorContextKey("Type")
	DB_ROLE           = ErrorContextKey("DbRole")
)

Variables

View Source
var (
	ErrBaseDb              = &DbError{}
	ErrMissingRoleMapping  = ErrBaseDb.With("Missing role mapping for DB table")
	ErrNotPtrToStructSlice = ErrBaseDb.With("Argument is invalid")
	ErrInvalidPortNumber   = ErrBaseDb.With("Port # is invalid")
	ErrMissingEnvVar       = ErrBaseDb.With("An environment variable is missing or empty")
	ErrMissingOrgId        = ErrBaseDb.With("OrgId is missing in context")
	ErrConnectingToDb      = ErrBaseDb.With("Failed to establish a connection with database")
	ErrExecutingSqlStmt    = ErrBaseDb.With("SQL statement could not be executed")
	ErrRegisteringStruct   = ErrBaseDb.With("Registration of a struct with DAL failed")
	ErrStartingTx          = ErrBaseDb.With("Failed to start a transaction")
	ErrCommittingTx        = ErrBaseDb.With("Failed to commit a transaction")
	ErrRevisionConflict    = ErrBaseDb.With("Blocking update due to outdated revision")
	ErrMarshalling         = ErrBaseDb.With("Cannot marshal proto message to binary")
	ErrUnmarshalling       = ErrBaseDb.With("Cannot unmarshal binary to proto message")
	ErrOperationNotAllowed = ErrBaseDb.With("Not authorized to perform the operation on other's data")
	ErrFetchingMetadata    = ErrBaseDb.With("Error fetching metadata from GRPC context")
	ErrTableDoesNotExist   = ErrBaseDb.With("Table does not exist")
	ErrRecordNotFound      = ErrBaseDb.With("Unable to locate record")
	ErrNotPtrToStruct      = ErrBaseDb.With("PointerToStruct expected, invalid type provided")

	ErrAuthContext       = ErrBaseDb.With("Error extracting authContext from context")
	ErrNoAuthContext     = ErrBaseDb.With("Permission denied because authContext is missing")
	ErrNoUserContext     = ErrBaseDb.With("Permission denied because userInformation is missing")
	ErrUserNotAuthorized = ErrBaseDb.With("User is not authorized to access this API")
	ErrMissingInstanceId = ErrBaseDb.With("Instance ID is not configured in the context")

	ErrMarkingEnforcementFailed = ErrBaseDb.With("Failed to mark resource's enforcement status")
	ErrGettingRealizationStatus = ErrBaseDb.With("Failed to get resource's realization status")
	ErrResourceStillExists      = ErrBaseDb.With("Resource still exists")
)

Functions

This section is empty.

Types

type DbError

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

func (*DbError) Error

func (e *DbError) Error() string

func (*DbError) Is

func (e *DbError) Is(target error) bool

func (*DbError) Unwrap

func (e *DbError) Unwrap() error

func (*DbError) With

func (e *DbError) With(msg string) *DbError

func (*DbError) WithContext

func (e *DbError) WithContext(ctx context.Context) *DbError

func (*DbError) WithMap

func (e *DbError) WithMap(kvMap map[ErrorContextKey]string) *DbError

func (*DbError) WithValue

func (e *DbError) WithValue(key ErrorContextKey, value string) *DbError

func (*DbError) Wrap

func (e *DbError) Wrap(err error) *DbError

type ErrorContextKey

type ErrorContextKey string

func (ErrorContextKey) String

func (c ErrorContextKey) String() string

Jump to

Keyboard shortcuts

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