errors

package
v2.0.2+incompatible Latest Latest
Warning

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

Go to latest
Published: Feb 7, 2018 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func RomanaErrorToHTTPError

func RomanaErrorToHTTPError(err error) error

romanaErrorToHTTPError is a helper method that creates an HTTP error (one that the middleware automatically converts to the right HTTP status code and response) from the provided Romana error, if possible. If the provided is not a Romana error, or if no corresponding HTTP errror can be provided, the original error is returned. Thus the signature takes a generic error and also returns it.

Types

type RomanaExistsError

type RomanaExistsError struct {
	Type string
	// Attributes represent key-value pairs used to add
	// the object.
	Attributes map[string]string
	Object     interface{}
	Message    string
}

RomanaExistsError represents an error when an entity already exists.

func NewRomanaExistsError

func NewRomanaExistsError(obj interface{}, t string, attrs ...string) RomanaExistsError

func NewRomanaExistsErrorWithMessage

func NewRomanaExistsErrorWithMessage(msg string, obj interface{}, t string, attrs ...string) RomanaExistsError

func (RomanaExistsError) Error

func (ree RomanaExistsError) Error() string

type RomanaNotFoundError

type RomanaNotFoundError struct {
	// Attributes represent key-value pairs used to search
	// for the object.
	Attributes map[string]string
	Type       string
	Message    string
}

RomanaNotFoundError represents an error when an entity (or resource) is not found. It is a separate error because clients may wish to check for this error.

func NewRomanaNotFoundError

func NewRomanaNotFoundError(message string, t string, attrs ...string) RomanaNotFoundError

NewRomanaNotFoundError creates a RomanaNotFoundError. Each element of attrs is interpreted as a "key=value" pair.

func (RomanaNotFoundError) Error

func (rnfe RomanaNotFoundError) Error() string

Jump to

Keyboard shortcuts

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