httperror

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Jan 1, 2022 License: Apache-2.0 Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func New

func New(status int, format string, args ...interface{}) error

Creates a new error with a format string

func Wrap

func Wrap(status int, wrapped error) error

Wraps an existing error with an http status code

Types

type HttpError

type HttpError struct {
	Status  int    `json:"status"`
	Message string `json:"message"`
	// contains filtered or unexported fields
}

Error containing an internal error and corresponding http response data

func Convert

func Convert(err error) *HttpError

Checks if the error is an http error. If it is, returns it cast as an HttpError If not, provides a new wrapped http error

func (HttpError) Error

func (err HttpError) Error() string

Jump to

Keyboard shortcuts

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