recovery

package
v0.0.4 Latest Latest
Warning

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

Go to latest
Published: Jun 23, 2021 License: Apache-2.0 Imports: 18 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// The amount of files in the stack to be retrieved.
	StackDepth = 200
	// How many files to move up in the runtime.Caller
	// before obtaining the stack.
	StackSkip = 2
)
View Source
const (
	// TplPrefix defines the prefix for template searching
	// such as "errors-500.html".
	TplPrefix = "error"
	// The extension of the web error file.
	VerbisErrorExtension = ".html"
	// The main layout of the web error file.
	VerbisErrorLayout = "layouts/main"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	Code    int
	Context *gin.Context
	Error   interface{}
	TplFile string
	TplExec tpl.TemplateExecutor
	Post    *domain.PostDatum
}

Config defines

type Context

type Context struct {
	Version string
	Site    domain.Site
	Options domain.Options
}

Context represents general information about Verbis to help with debugging.

type Data

type Data struct {
	Error      Error
	StatusCode int
	Request    Request
	Post       *domain.PostDatum
	Stack      trace.Stack
	Context    Context
	Debug      bool
}

Data represents the main struct for sending back data to the template for recovery.

type Error

type Error struct {
	Code      string
	Message   string
	Operation string
	Err       string
}

Error represents a errors.Error in friendly form (strings) to for the recovery template.

type Handler

type Handler struct {
	// contains filtered or unexported fields
}

func New

func New(d *deps.Deps) *Handler

func (*Handler) HTTPRecovery

func (h *Handler) HTTPRecovery() gin.HandlerFunc

HTTPRecovery

func (*Handler) Recover

func (h *Handler) Recover(cfg Config) []byte

Recover

type Recover

type Recover struct {
	// contains filtered or unexported fields
}

Recover defines

type Recovery

type Recovery interface {
	Recover(cfg Config) []byte
	HttpRecovery() gin.HandlerFunc
}

type Request

type Request struct {
	URL        string
	Method     string
	IP         string
	Referer    string
	DataLength int
	Body       string
	Headers    map[string][]string
	Query      map[string][]string
	Cookies    []*http.Cookie
}

Request represents the data obtained from the context with detailed information about the http request made.

type Resolver

type Resolver func(custom bool) (string, tpl.TemplateExecutor, bool)

type TplData

type TplData func() *Data

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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