errors

package
v0.0.0-...-9c1cc18 Latest Latest
Warning

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

Go to latest
Published: Feb 20, 2023 License: MIT Imports: 1 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"`
}

ErrorResponse is the response for an error.

func BadRequest

func BadRequest(msg string) ErrorResponse

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

func InternalServerError

func InternalServerError(msg string) ErrorResponse

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

func Unauthorized

func Unauthorized(msg string) ErrorResponse

Unauthorized creates a new error response representing an unauthorized request (HTTP 401)

func (ErrorResponse) Error

func (e ErrorResponse) Error() string

Error is required by error interface.

func (ErrorResponse) StatusCode

func (e ErrorResponse) StatusCode() int

StatusCode returns the HTTP status code for the error.

Jump to

Keyboard shortcuts

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