http

package
v0.0.0-...-9ba5f82 Latest Latest
Warning

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

Go to latest
Published: Oct 27, 2023 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ErrorResponse

func ErrorResponse(w http.ResponseWriter, message string, httpStatusCode int)

func WriteInternalError

func WriteInternalError(w http.ResponseWriter, verr *VerboseError, r *http.Request, log *logrus.Entry)

func WriteNotFoundError

func WriteNotFoundError(err error, w http.ResponseWriter, log *logrus.Entry)

func WriteResponse

func WriteResponse(w http.ResponseWriter, body any, httpStatusCode int)

Types

type Error

type Error struct {
	Message string `json:"message"`
}

type VerboseError

type VerboseError struct {
	Class         string
	Message       string
	Method        string
	Endpoint      string
	OriginalError error
}

func NewNotFoundError

func NewNotFoundError(r *http.Request) *VerboseError

func NewVerboseError

func NewVerboseError(class string, r *http.Request, err error) *VerboseError

func (*VerboseError) Error

func (v *VerboseError) Error() string

Jump to

Keyboard shortcuts

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