httperror

package
v1.0.1-1 Latest Latest
Warning

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

Go to latest
Published: Jan 10, 2026 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// Errors messages
	BAD_ERROR string = "error text doesn't match. Won't `%s`, but got `%s`"
	BAD_CODE  string = "error code don't match. Won't `%d`, but got `%d`"
	BAD_TYPE  string = "error type don't match. Won't `%v`, but got `%v`"

	INTERNAL HttpErrorType = iota
	EXTERNAL
)

Variables

This section is empty.

Functions

This section is empty.

Types

type HttpError

type HttpError struct {
	Type       HttpErrorType
	StatusCode int
	// contains filtered or unexported fields
}

func NewExternalHttpError

func NewExternalHttpError(err error, status_code int) HttpError

func NewInternalHttpError

func NewInternalHttpError(err error, func_name string) HttpError

func (HttpError) Append

func (herr HttpError) Append(new_err error) HttpError

Add new info to error description. For example:

error "internal error" + error "fatal error" = error "internal error;\nfatal error"

func (HttpError) CompareWith

func (herr HttpError) CompareWith(http_error HttpError) error

Return nil, if errors not different

func (HttpError) Error

func (herr HttpError) Error() string

func (HttpError) WithFuncName

func (herr HttpError) WithFuncName(func_name string) HttpError

Change func name, which will be logged

func (HttpError) Write

func (herr HttpError) Write(w http.ResponseWriter)

type HttpErrorType

type HttpErrorType int

Jump to

Keyboard shortcuts

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