errors

package
v1.9.8 Latest Latest
Warning

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

Go to latest
Published: Mar 3, 2018 License: MIT Imports: 13 Imported by: 1 module, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrorEmptyLogger issued when logger received empty logger to New-method
	ErrorEmptyLogger = errors.New("options hasn't logger")
)

Functions

This section is empty.

Types

type Logic

type Logic struct {
	Opts Options
}

Logic is an structure for capture and recover web-errors and panics

func New

func New(opts Options) (*Logic, error)

New creates instance of Logic structure

func (*Logic) Capture

func (c *Logic) Capture(err error, ctx echo.Context)

Capture web-errors and formatting answer

func (*Logic) Recover

func (c *Logic) Recover() echo.MiddlewareFunc

Recover is an echo-middleware to capture panics in controllers/actions and send info to sentry

type LogicError

type LogicError struct {
	Code    int
	Message string
}

LogicError used for web-controllers

func NewError

func NewError(code int, message string) *LogicError

NewError return LogicError with http-code and error message

func NewErrorf

func NewErrorf(code int, format string, a ...interface{}) *LogicError

NewErrorf return LogicError with http-code and formatted error message

func (*LogicError) Error

func (err *LogicError) Error() string

Error is an implementation of error interface

type Options

type Options struct {
	Debug  bool
	Logger logger.Logger
}

Options for creating new Logic

type Response

type Response struct {
	Error  string   `json:"error"`
	Stack  []string `json:"stack"`
	Result []string `json:"result"`
}

Response answer structure

Jump to

Keyboard shortcuts

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