errors

package
v0.0.0-...-ae1d368 Latest Latest
Warning

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

Go to latest
Published: Jun 22, 2020 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewStorageError

func NewStorageError(errorType StorageErrorType, err error) error

newStorageError takes an SQL error and returns a corresponding storage error

func NewStorageErrorFromError

func NewStorageErrorFromError(err error) error

NewStorageErrorFromError is a helper function to easily handle a error received during interacting with an sql engine. It will try to find the correct StorageErrorType and populate a StorageError accordingly.

Types

type StorageError

type StorageError struct {
	Type         StorageErrorType
	Message      string
	WrappedError error
}

ErrorResponse is a generic response type for errors in HTTP requests

func (*StorageError) Error

func (storageError *StorageError) Error() string

type StorageErrorType

type StorageErrorType string
const (
	NotFoundError       StorageErrorType = "Not Found Error"
	ForeignKeyViolation StorageErrorType = "Foreign Key Violation"
	InternalError       StorageErrorType = "Internal Error"
	AlreadyExistsError  StorageErrorType = "Already exists error"
	// AccessDeniedError is returned when the user is trying to access an entity which it doesn't control
	AccessDeniedError StorageErrorType = "Access Denied Error"
)

Jump to

Keyboard shortcuts

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