servererror

package
v0.4.2 Latest Latest
Warning

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

Go to latest
Published: Nov 13, 2023 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ProcessHTTPError

func ProcessHTTPError(err error, w http.ResponseWriter, _ *http.Request)

ProcessHTTPError writes formated error response to w

Types

type ServerErrorData

type ServerErrorData struct {
	Parent      error  `json:"-"`
	Code        int    `json:"code,omitempty"`
	Message     string `json:"message,omitempty"`
	Description string `json:"description,omitempty"`
	Stack       string `json:"-"`
}

ServerErrorData is custom error that should be used to describe better errors

func ServerError

func ServerError(Parent error, Code int, Message string) *ServerErrorData

ServerError Create error object

func (*ServerErrorData) Error

func (e *ServerErrorData) Error() string

type ServerErrorLoginRequired

type ServerErrorLoginRequired struct {
	*ServerErrorData
	LoginRequired bool `json:"login_required,omitempty"`
}

ServerErrorLoginRequired is server error that can provide info if login is required

type ServerErrorWithText

type ServerErrorWithText struct {
	*ServerErrorData
	ErrorText string `json:"error,omitempty"`
}

ServerErrorWithText extra text

Jump to

Keyboard shortcuts

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