errorutils

package
v0.0.0-...-acd5dfc Latest Latest
Warning

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

Go to latest
Published: Sep 6, 2023 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var CheckError = func(err error) error {
	return err
}

Functions

func CheckErrorf

func CheckErrorf(format string, a ...interface{}) error

func CheckResponseStatus

func CheckResponseStatus(resp *http.Response, expectedStatusCodes ...int) error

Check expected status codes and return error if needed

func CheckResponseStatusWithBody

func CheckResponseStatusWithBody(resp *http.Response, body []byte, expectedStatusCodes ...int) error

Check expected status codes and return error with body if needed We use body variable that was saved outside the resp.body object, Instead of resp.Body because resp.body disappears after resp.body.Close()

func GenerateErrorString

func GenerateErrorString(bodyArray []byte) string

func GenerateResponseError

func GenerateResponseError(status, body string) error

Types

type OnErrorHandler

type OnErrorHandler func(error) error

Error modes (how should the application behave when the CheckError function is invoked):

Jump to

Keyboard shortcuts

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