errors

package
v0.0.2 Latest Latest
Warning

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

Go to latest
Published: Feb 24, 2021 License: Apache-2.0 Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ShowStatusCodeInHTTPError

func ShowStatusCodeInHTTPError(value bool)

ShowStatusCodeInError enables showing status code package wide. Status code is shown in error message only if it's set

Types

type ErrorWithMetadata

type ErrorWithMetadata interface {
	error
	fmt.Stringer

	ErrorValue() string
	Metadata() interface{}

	SetError(string) ErrorWithMetadata
	SetMetadata(interface{}) ErrorWithMetadata
}

func NewErrorWithMetadata

func NewErrorWithMetadata() ErrorWithMetadata

type HTTPError

type HTTPError interface {
	error
	StatusCode() uint

	WithStatusCode(uint) HTTPError
}

HTTPError interface gives error and status code

func HTTPErrorf

func HTTPErrorf(format string, args ...interface{}) HTTPError

Errorf returns a HTTPError with status code 500, format, and arguments

func HTTPErrorfWithStatusCode

func HTTPErrorfWithStatusCode(statusCode uint, format string, args ...interface{}) HTTPError

ErrorfWithStatusCode returns a HTTPError with status code, format, and arguments

func NewHTTPError

func NewHTTPError(errorString string) HTTPError

New returns a new HTTPError

Jump to

Keyboard shortcuts

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