app

package
v0.0.0-...-83f3c07 Latest Latest
Warning

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

Go to latest
Published: Apr 9, 2023 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrNotFound   = &sentinelAPIError{status: http.StatusNotFound, message: "Resource not found", wrappedError: nil}
	ErrInternal   = &sentinelAPIError{status: http.StatusInternalServerError, message: "Unexpected error found", wrappedError: nil}
	ErrBadRequest = &sentinelAPIError{status: http.StatusBadRequest, message: "Invalid data", wrappedError: nil}
)

Functions

func HandlerWithErrors

func HandlerWithErrors(fn RootHandler) http.HandlerFunc

Types

type APIError

type APIError interface {
	APIError() (int, string)
	GetStatus() int
	GetMessage() string
	Error() string
	Unwrap() error
}

func NewAPIError

func NewAPIError(status int, message string, wrappedError error) APIError

type RootHandler

type RootHandler func(w http.ResponseWriter, r *http.Request) error

Jump to

Keyboard shortcuts

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