errors

package
v0.0.0-...-692e367 Latest Latest
Warning

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

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

Documentation

Index

Constants

View Source
const (
	StatusNotFound            = "Not Found"
	StatusBadParameter        = "Bad Parameter"
	StatusInUse               = "In use"
	StatusBadRequest          = "Bad Request"
	StatusUnknown             = "Unknown"
	StatusIncorrectXml        = "Incorrect Xml"
	StatusIncorrectJson       = "Incorrect Json"
	StatusNotUnique           = "Not Unique"
	StatusInternalServerError = "Internal Server Error"
	StatusForbidden           = "Forbidden"
	StatusNotAllowed          = "Not Allowed"
)
View Source
const (
	ErrorInviteNotFound = iota
	ErrorUsernameInUse
	ErrorEmailInUse
	ErrorAccountNotFound
	ErrorNotUnique
	ErrorAlreadyAttached
	ErrorNoAttached
	ErrorUnknown
)

Variables

View Source
var GrpcErrorHandlerFunc = HTTP.ParseGrpcError

Functions

func GetError

func GetError(code ErrorCode) error

func GetErrorMessage

func GetErrorMessage(code ErrorCode) string

func New

func New(text string) *err

Types

type Err

type Err struct {
	Code string
	Attr string
	// contains filtered or unexported fields
}

func BadParameter

func BadParameter(attr string, e ...error) *Err

func Forbidden

func Forbidden(e ...error) *Err

func IncorrectJSON

func IncorrectJSON(e ...error) *Err

func IncorrectXML

func IncorrectXML(e ...error) *Err

func NotAllowed

func NotAllowed(e ...error) *Err

func Unknown

func Unknown(e ...error) *Err

func (*Err) Err

func (e *Err) Err() error

func (*Err) Http

func (e *Err) Http(w http.ResponseWriter)

func (*Err) SetMessage

func (e *Err) SetMessage(s string) *Err

type ErrorCode

type ErrorCode int

type Http

type Http struct {
	Code    int    `json:"code"`
	Status  string `json:"status"`
	Message string `json:"message"`
}
var HTTP Http

func (Http) BadGateway

func (Http) BadGateway(w http.ResponseWriter)

func (Http) BadParameter

func (Http) BadParameter(w http.ResponseWriter, args ...string)

func (Http) BadRequest

func (Http) BadRequest(w http.ResponseWriter, msg ...string)

func (Http) Forbidden

func (Http) Forbidden(w http.ResponseWriter, msg ...string)

func (Http) InternalServerError

func (Http) InternalServerError(w http.ResponseWriter, msg ...string)

func (Http) InvalidJSON

func (Http) InvalidJSON(w http.ResponseWriter, msg ...string)

func (Http) InvalidXML

func (Http) InvalidXML(w http.ResponseWriter, msg ...string)

func (Http) NotAllowed

func (Http) NotAllowed(w http.ResponseWriter, msg ...string)

func (Http) NotFound

func (Http) NotFound(w http.ResponseWriter, args ...string)

func (Http) NotImplemented

func (Http) NotImplemented(w http.ResponseWriter, msg ...string)

func (Http) ParseGrpcError

func (h Http) ParseGrpcError(w http.ResponseWriter, err error)

func (Http) PaymentRequired

func (Http) PaymentRequired(w http.ResponseWriter, msg ...string)

func (Http) Unauthorized

func (Http) Unauthorized(w http.ResponseWriter, msg ...string)

Jump to

Keyboard shortcuts

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