errors

package
v0.0.82 Latest Latest
Warning

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

Go to latest
Published: Nov 8, 2022 License: BSD-3-Clause Imports: 3 Imported by: 0

Documentation

Index

Constants

View Source
const (
	BadRequest                  = "HTTP Bad Request"                   // 400
	Forbidden                   = "HTTP Forbidden"                     // 403
	NotFound                    = "HTTP Not Found"                     // 404
	ProxyAuthenticationRequired = "HTTP Proxy Authentication Required" // 407
	Conflict                    = "HTTP Conflict"                      // 409
	InternalServerError         = "HTTP Internal Server Error"         // 500
)

This package is designed to help influence the status code sent when an error is returned via an API. Just include one of the strings below in your error message text and the appropriate status code will get set if that error is ever serialized into an API response. InternalServerError takes precedence, and if an error doesn't include any of the strings at all then it is treated like an InternalServerError.

Variables

This section is empty.

Functions

This section is empty.

Types

type ErrorResponse

type ErrorResponse struct {
	ToBlame string `json:"toBlame"`
	Type    string `json:"type"`
	Message string `json:"message"`
}

func ErrorToApiResponse

func ErrorToApiResponse(err error) (int, ErrorResponse)

Jump to

Keyboard shortcuts

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