httperrors

package
v0.4.0-alpha.8 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func HTTPErrorHandler

func HTTPErrorHandler(err error, c echo.Context)

HTTPErrorHandler must be hooked to an echo server to render instances of HTTPError as JSON

Types

type HTTPError

type HTTPError struct {
	Code    int
	Message string
}

HTTPError implements the Go error interface, and includes an HTTP response code. Any webapi endpoint can return an instance of HTTPError, and it will be rendered as JSON in the response.

func BadRequest

func BadRequest(message string) *HTTPError

func Conflict

func Conflict(message string) *HTTPError

func NotFound

func NotFound(message string) *HTTPError

func ServerError

func ServerError(message string) *HTTPError

func Timeout

func Timeout(message string) *HTTPError

func (*HTTPError) Error

func (he *HTTPError) Error() string

Jump to

Keyboard shortcuts

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