httperr

package
v0.0.0-...-d5dcd45 Latest Latest
Warning

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

Go to latest
Published: Oct 31, 2022 License: MIT Imports: 6 Imported by: 0

Documentation

Overview

Package httperr provides a http error responses.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BadRequest

func BadRequest(c *gin.Context, slug string, err error)

BadRequest is a helper function to respond with bad request error.

func InternalError

func InternalError(c *gin.Context, slug string, err error)

InternalError is a helper function to respond with internal server error.

func RespondWithSlugError

func RespondWithSlugError(c *gin.Context, err error)

RespondWithSlugError is a helper function to respond with slug error.

func Unauthorised

func Unauthorised(c *gin.Context, slug string, err error)

Unauthorised is a helper function to respond with unauthorized error.

func UnprocessableEntity

func UnprocessableEntity(c *gin.Context, slug string, err error)

UnprocessableEntity is a helper function to respond with unprocessable entity error.

Types

type ErrorResponse

type ErrorResponse struct {
	Errors Errors `json:"errors"`
}

ErrorResponse is a error response.

type Errors

type Errors struct {
	Body []string `json:"body"`
}

Errors is a list of http errors.

Jump to

Keyboard shortcuts

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