error

package
v5.1.2 Latest Latest
Warning

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

Go to latest
Published: May 22, 2024 License: MIT Imports: 4 Imported by: 2

Documentation

Overview

Package error contains the Handler which manages the error handling in the microservices. It creates a buffered channel and adds it to the request's context for usage in handlers. The channel's key is automatically generated at compile-time and accessible via the ChannelName constant. The channel accepts wisdomTypes.WISdoMError and native error objects. The handler also intercepts any panic ocurring in the code and tries to return it in a response.

Index

Constants

View Source
const (
	ChannelName = string(rune(iota))
)

Variables

View Source
var InvalidTypeProvided = wisdomType.WISdoMError{
	Type:   "https://pkg.go.dev/github.com/wisdom-oss/microservice-middlewares/v4#InvalidTypeProvided",
	Status: 500,
	Title:  "Invalid Type Provided",
	Detail: "An invalid type has been provided to the error handler. Please contact your administrator",
}

InvalidTypeProvided represents an internal error which is sent if an invalid type as been provided to the input channel of the error handler

View Source
var NotFound = wisdomType.WISdoMError{
	Type:   "https://www.rfc-editor.org/rfc/rfc9110#section-15.5.5",
	Status: 404,
	Title:  "Route Not Found",
	Detail: "The requested route was not found. Please check your request and ensure that the route is correctly set up in the service",
}
View Source
var Panic = wisdomType.WISdoMError{
	Type:   "https://www.rfc-editor.org/rfc/rfc9110#section-15.6.1",
	Status: 500,
	Title:  "Internal Panic Occurred",
	Detail: "An internal panic has occurred during the handling of your request. Please contact your administrator if this happens again",
}

Functions

func Handler

func Handler(next http.Handler) http.Handler

func NotFoundError added in v5.1.0

func NotFoundError(w http.ResponseWriter, _ *http.Request)

Types

This section is empty.

Jump to

Keyboard shortcuts

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