errors

package
v0.1.8 Latest Latest
Warning

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

Go to latest
Published: Oct 24, 2019 License: MIT Imports: 3 Imported by: 0 modules, 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

This section is empty.

Functions

func BadRequest

func BadRequest(detail string) error

BadRequest generates a 400 error.

func Conflict

func Conflict(detail string) error

Conflict generates a 409 error.

func Forbidden

func Forbidden(detail string) error

Forbidden generates a 403 error.

func InternalServerError

func InternalServerError(detail string) error

InternalServerError generates a 500 error.

func New

func New(detail string, code int32) error

New generates a custom error.

func NotFound

func NotFound(detail string) error

NotFound generates a 404 error.

func Unauthorized

func Unauthorized(detail string) error

Unauthorized generates a 401 error.

Types

type Error

type Error struct {
	ID     string `json:"id"`
	Code   int32  `json:"code"`
	Detail string `json:"detail"`
	Status string `json:"status"`
}

Error implements the error interface.

func Parse

func Parse(err string) *Error

Parse tries to parse a JSON string into an error. If that// fails, it will set the given string as the error detail.

func (*Error) Error

func (e *Error) Error() string

Jump to

Keyboard shortcuts

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