errors

package
v0.2.7-alpha Latest Latest
Warning

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

Go to latest
Published: Sep 11, 2016 License: Apache-2.0 Imports: 3 Imported by: 4

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func RespondWithError

func RespondWithError(w http.ResponseWriter, err error)

RespondWithError responds, using the supplied response writer, with an error. If the error is a PublicError, then its message is sent in the response. Otherwise, a generic internal server error message is sent.

Types

type InvalidParameterError

type InvalidParameterError struct {
	ParameterName  string
	ParameterValue interface{}
}

InvalidParameterError is an error that occurs when a particular parameter defies expectations.

func NewInvalidParameterError

func NewInvalidParameterError(
	parameterName string,
	parameterValue interface{},
) InvalidParameterError

NewInvalidParameterError creates a new InvalidParameterError.

func (InvalidParameterError) Error

func (err InvalidParameterError) Error() string

func (InvalidParameterError) String

func (err InvalidParameterError) String() string

type NoSuchPackageError

type NoSuchPackageError struct {
	PackageAuthor string
	PackageRepo   string
	CausedBy      []error
}

NoSuchPackageError is an error that occurs when a requested package doesn't exist.

func NewNoSuchPackageError

func NewNoSuchPackageError(
	packageAuthor string,
	packageRepo string,
	causes ...error,
) NoSuchPackageError

NewNoSuchPackageError creates a new NoSuchPackageError.

func (NoSuchPackageError) Causes

func (err NoSuchPackageError) Causes() []error

Causes returns the error(s) that caused this error.

func (NoSuchPackageError) Error

func (err NoSuchPackageError) Error() string

func (NoSuchPackageError) PublicError

func (err NoSuchPackageError) PublicError() (int, string)

PublicError returns an outside-friendly error message, and a corresponding status code.

type PublicError

type PublicError interface {
	// PublicError returns an outside-friendly error message, and a
	// corresponding status code.
	PublicError() (int, string)
}

PublicError is an error that has an outside-friendly error message, and a corresponding status code.

type QueryScanError

type QueryScanError struct {
	ScanError, CloseError error
}

QueryScanError is an error that occurs when the result of a database query was not processed successfully.

func NewQueryScanError

func NewQueryScanError(scanError, closeError error) QueryScanError

NewQueryScanError creates a new QueryScanError.

func (QueryScanError) Error

func (err QueryScanError) Error() string

func (QueryScanError) String

func (err QueryScanError) String() string

type ResultingError

type ResultingError interface {
	// Causes returns the list of errors that preceded this one.
	Causes() []error
}

ResultingError is an error that reuslted from other errors.

Jump to

Keyboard shortcuts

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