errorwithstatus

package
v4.13.0 Latest Latest
Warning

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

Go to latest
Published: May 24, 2024 License: Apache-2.0 Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Error

type Error interface {
	error
	Status() int
}

Error represents a handler error. It provides methods for a HTTP status code and embeds the built-in error interface.

type StatusError

type StatusError struct {
	Code int
	Err  error
}

api.StatusError represents an error with an associated HTTP status code.

func MakeBadRequestError

func MakeBadRequestError(err error) StatusError

func MakeNotFoundError

func MakeNotFoundError(ID string) StatusError

Some common errors

func MakeStatusError

func MakeStatusError(code int, err error) StatusError

Mainly so we don't get a bunch of errors for not using field names in StatusError{}

func MakeUnauthorisedError

func MakeUnauthorisedError(err error) StatusError

func (StatusError) Error

func (se StatusError) Error() string

Allows api.StatusError to satisfy the error interface.

func (StatusError) Status

func (se StatusError) Status() int

Status - Returns our HTTP status code.

Jump to

Keyboard shortcuts

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