errors

package
v1.2.8 Latest Latest
Warning

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

Go to latest
Published: Nov 16, 2024 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func FromCode

func FromCode(code int) error

func New

func New(code int, message string) error

func StatusCode

func StatusCode(text any) int

StatusCode is a reverse function of http.StatusText.

Types

type HTTPError

type HTTPError struct {
	Code    int    `json:"code"`
	Message string `json:"message"`
}

HTTPError implements error interface with HTTP status code.

func (*HTTPError) Error

func (e *HTTPError) Error() string

Error implements the error interface and returns a string.

func (*HTTPError) MarshalJSON

func (e *HTTPError) MarshalJSON() ([]byte, error)

func (*HTTPError) StatusCode

func (e *HTTPError) StatusCode() int

Jump to

Keyboard shortcuts

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