errors

package
v0.8.0 Latest Latest
Warning

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

Go to latest
Published: Oct 30, 2024 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ErrorResponse

type ErrorResponse struct {
	Status  int         `json:"status"`
	Message string      `json:"message"`
	Details interface{} `json:"details,omitempty"`
}

ErrorResponse is the response that represents an error.

func BadRequest

func BadRequest(msg string) ErrorResponse

BadRequest creates a new error response representing a bad request (HTTP 400).

func BuildErrorResponse

func BuildErrorResponse(err error, trans ut.Translator) ErrorResponse

BuildErrorResponse builds an error response from an error.

func Forbidden

func Forbidden(msg string) ErrorResponse

Forbidden creates a new error response representing an authorization. failure (HTTP 403)

func InternalServerError

func InternalServerError(msg string) ErrorResponse

InternalServerError creates a new error response representing an internal server error (HTTP 500)

func NotFound

func NotFound(msg string) ErrorResponse

NotFound creates a new error response representing a resource-not-found error (HTTP 404)

func TooLargeEntity

func TooLargeEntity(msg string) ErrorResponse

TooLargeEntity creates a new error response representing a an entity larger than limits defined by server (HTTP 413).

func Unauthorized

func Unauthorized(msg string) ErrorResponse

Unauthorized creates a new error response representing an authentication/authorization failure (HTTP 401)

func UnsupportedMediaType added in v0.3.0

func UnsupportedMediaType(msg string) ErrorResponse

UnsupportedMediaType creates a new error response representing a an unsupported media type (HTTP 415).

func (ErrorResponse) Error

func (e ErrorResponse) Error() string

Error is required by the error interface.

func (ErrorResponse) StatusCode

func (e ErrorResponse) StatusCode() int

StatusCode is required by routing.HTTPError interface.

Jump to

Keyboard shortcuts

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