gerror

package
v0.11.10 Latest Latest
Warning

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

Go to latest
Published: May 15, 2019 License: Apache-2.0 Imports: 2 Imported by: 9

Documentation

Overview

Package gerror defines a custom error type with a HTTP status code for goiardi. This used to be in the util package, but has been moved out into its own module. For convenience, and because the old methods are called everywhere, there are wrappers in util for the Error interface here, along with the Errorf and CastErr functions.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Error

type Error interface {
	String() string
	Error() string
	Status() int
	SetStatus(int)
}

Error is an error type that includes an http status code (defaults to http.BadRequest).

func CastErr

func CastErr(err error) Error

CastErr will easily cast a different kind of error to a goiardi Error.

func Errorf

func Errorf(format string, a ...interface{}) Error

Errorf creates a new Error, with a formatted error string.

func New

func New(text string) Error

New makes a new Error. Usually you want Errorf.

func StatusError

func StatusError(msg string, status int) Error

StatusError makes an error with a string and a HTTP status code.

Jump to

Keyboard shortcuts

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