client_error

package
v0.0.0-...-4892902 Latest Latest
Warning

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

Go to latest
Published: Dec 20, 2022 License: Apache-2.0 Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ClientError

type ClientError interface {
	Error() string
	// ResponseBody returns response body.
	ResponseBody() ([]byte, error)
	// ResponseHeaders returns http status code and headers.
	ResponseHeaders() (int, map[string]string)
}

ClientError is an error whose details to be shared with client.

type HTTPError

type HTTPError struct {
	Cause    error    `json:"-"`
	Messages []string `json:"messages"`
	Status   int      `json:"-"`
}

HTTPError implements ClientError interface.

func NewHTTPError

func NewHTTPError(err error, status int, messages []string) *HTTPError

func (*HTTPError) Error

func (e *HTTPError) Error() string

func (*HTTPError) ResponseBody

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

ResponseBody returns JSON response body.

func (*HTTPError) ResponseHeaders

func (e *HTTPError) ResponseHeaders() (int, map[string]string)

ResponseHeaders returns http status code and headers.

Jump to

Keyboard shortcuts

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