httperrors

package
v0.3.8 Latest Latest
Warning

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

Go to latest
Published: Oct 18, 2022 License: Apache-2.0, BSD-2-Clause Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func HTTPErrorHandler added in v0.2.0

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 added in v0.2.0

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