mistake

package module
v0.0.0-...-832c731 Latest Latest
Warning

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

Go to latest
Published: May 13, 2021 License: MIT Imports: 6 Imported by: 0

README

OMEH - One more error handler

Go Error handler

Godoc license

Documentation

Index

Constants

This section is empty.

Variables

View Source
var StatusBadRequest = &ErrResponse{HTTPStatusCode: 400, StatusText: "Status Bad Request"}
View Source
var StatusInternalServerError = &ErrResponse{HTTPStatusCode: 500, StatusText: "Status Internal Server Error"}
View Source
var StatusNotFound = &ErrResponse{HTTPStatusCode: 404, StatusText: "Status Not Found"}
View Source
var YouDoneMessedUpAARon = &ErrResponse{HTTPStatusCode: 500, StatusText: "You done messed up, A-A-Ron"}

Functions

This section is empty.

Types

type ErrManager

type ErrManager struct {
	ErrorHandler     processError
	LogError         handleErrorLog
	HandleHTTPErrors respondToError
	// contains filtered or unexported fields
}

func New

func New(d bool) *ErrManager

func (*ErrManager) ProcessErrorHTTP

func (e *ErrManager) ProcessErrorHTTP(h ErrorHandlerdesc) http.HandlerFunc

func (*ErrManager) ReturnError

func (e *ErrManager) ReturnError(err error, er *ErrResponse, requestDetails string) *ErrResponse

func (*ErrManager) SetDebug

func (e *ErrManager) SetDebug(d bool)

func (*ErrManager) SetDefaultHandler

func (e *ErrManager) SetDefaultHandler(def processError)

func (*ErrManager) SetErrorLogHandler

func (e *ErrManager) SetErrorLogHandler(handler handleErrorLog)

func (*ErrManager) SetHTTPErrorHandler

func (e *ErrManager) SetHTTPErrorHandler(handler respondToError)

type ErrResponse

type ErrResponse struct {
	Err            error   `json:"-"`
	HTTPStatusCode int     `json:"-"`
	RequestDetail  string  `json:"-"`
	FuncPC         uintptr `json:"-"`
	FuncFN         string  `json:"-"`
	FuncLine       int     `json:"-"`

	StatusText string `json:"status"`
	AppCode    int64  `json:"code,omitempty"`
}

type ErrorHandlerdesc

type ErrorHandlerdesc func(http.ResponseWriter, *http.Request) *ErrResponse

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL
JackTT - Gopher 🇻🇳