errors

package module
v0.0.0-...-a597e66 Latest Latest
Warning

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

Go to latest
Published: Jun 16, 2017 License: Apache-2.0 Imports: 5 Imported by: 10

README

errors godoc badge

Installation

$ go get -u github.com/plimble/errors

Usage


func main(){

  err1 = errors.New("error message")
  err2 = errors.Newf("%s", "error message")
  err2 = errors.NewCode(404,"error message")
  err2 = errors.NewCodef(404, "%s", "error message")
  err3 = errors.InternalError("error message")
}


Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Cause

func Cause(err error) error

func ErrStatus

func ErrStatus(err error) int

func IsBadRequest

func IsBadRequest(err error) bool

func IsForbidden

func IsForbidden(err error) bool

func IsInternalError

func IsInternalError(err error) bool

func IsNotFound

func IsNotFound(err error) bool

func IsUnauthorized

func IsUnauthorized(err error) bool

func New

func New(msg string) error

func Newf

func Newf(format string, v ...interface{}) error

func ToGRPC

func ToGRPC(err error) error

func Wrap

func Wrap(err error, httpError *HTTPError) error

Types

type HTTPError

type HTTPError struct {
	Message string `json:"error"`
	// contains filtered or unexported fields
}

func BadRequest

func BadRequest(msg string) *HTTPError

func BadRequestf

func BadRequestf(format string, v ...interface{}) *HTTPError

func Error

func Error(status int, msg string) *HTTPError

func Errorf

func Errorf(status int, format string, v ...interface{}) *HTTPError

func Forbidden

func Forbidden(msg string) *HTTPError

func Forbiddenf

func Forbiddenf(format string, v ...interface{}) *HTTPError

func FromError

func FromError(err error) (*HTTPError, bool)

func InternalError

func InternalError(msg string) *HTTPError

func InternalErrorf

func InternalErrorf(format string, v ...interface{}) *HTTPError

func NotFound

func NotFound(msg string) *HTTPError

func NotFoundf

func NotFoundf(format string, v ...interface{}) *HTTPError

func NotImplement

func NotImplement(msg string) *HTTPError

func NotImplementf

func NotImplementf(format string, v ...interface{}) *HTTPError

func Timeout

func Timeout(msg string) *HTTPError

func Timeoutf

func Timeoutf(format string, v ...interface{}) *HTTPError

func Unauthorized

func Unauthorized(msg string) *HTTPError

func Unauthorizedf

func Unauthorizedf(format string, v ...interface{}) *HTTPError

func Unavailable

func Unavailable(msg string) *HTTPError

func Unavailablef

func Unavailablef(format string, v ...interface{}) *HTTPError

func UnknownError

func UnknownError(msg string) *HTTPError

func UnknownErrorf

func UnknownErrorf(format string, v ...interface{}) *HTTPError

func (*HTTPError) Cause

func (e *HTTPError) Cause() error

func (*HTTPError) Error

func (e *HTTPError) Error() string

func (*HTTPError) MarshalLogObject

func (e *HTTPError) MarshalLogObject(enc zapcore.ObjectEncoder) error

func (*HTTPError) WithCause

func (e *HTTPError) WithCause(err error) *HTTPError

Jump to

Keyboard shortcuts

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