weberrors

package
v0.3.1 Latest Latest
Warning

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

Go to latest
Published: Sep 15, 2021 License: BSD-3-Clause Imports: 1 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ErrorCode

func ErrorCode(e error) (errorCode int, cause error)

func HTTPStatusCode

func HTTPStatusCode(e error) (statusCode int, cause error)

func Headline

func Headline(e error) string

Message returns a headline for an error that is safe to be shown to the user

func Message

func Message(e error) string

Message returns an error message that is safe to be shown to the user

func WithMessage

func WithMessage(e error, headline, message string) error

WithMessage wraps an internal error with a user-facing message

Types

type CodeError

type CodeError interface {
	error
	ErrorCode() int
}

func WithCode

func WithCode(e error, c int) CodeError

type HTTPError

type HTTPError interface {
	error
	HTTPStatus() int
}

func WithStatus

func WithStatus(e error, c int) HTTPError

type Redirector

type Redirector interface {
	error
	RedirectLocation() string
}

type UserError

type UserError interface {
	error
	Headline() string
	Message() string
}

A UserError is an error that may be shown to end users

Jump to

Keyboard shortcuts

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