errors

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Mar 3, 2021 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var FiberErrorHandler = func(ctx *fiber.Ctx, err error) error {

	code := fiber.StatusInternalServerError
	msg := err.Error()

	if e, ok := err.(*fiber.Error); ok {
		code = e.Code
	}

	if code == 500 {
		msg = "Internal Server Error"
		LogError(err)
	}

	ctx.Set(fiber.HeaderContentType, fiber.MIMETextPlainCharsetUTF8)
	return ctx.Status(code).SendString(msg)
}

FiberErrorHandler is a fiber.Config parameter.

View Source
var NewHTTPError = fiber.NewError

NewHTTPError is fiber.NewError wrapper.

Functions

func Debug

func Debug(data interface{}) error

Debug returns any data as error for debugging.

func LogError added in v0.3.0

func LogError(err interface{})

LogError .

func SetLogger added in v0.3.0

func SetLogger(conf *config.Config)

SetLogger set logger in dependency injection.

func Wrap

func Wrap(err error, data interface{}) error

Wrap wraps error with additional data and stack info.

Types

This section is empty.

Jump to

Keyboard shortcuts

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