errs

package
v3.4.0 Latest Latest
Warning

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

Go to latest
Published: Sep 24, 2019 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrMissingObjectID    = errors.New("objectID is missing or empty")
	ErrMissingKeyID       = errors.New("key ID is not set in Key.Value")
	ErrNoMoreHostToTry    = errors.New("all hosts have been contacted unsuccessfully, it can either be a network error or wrong appID/key credentials were used")
	ErrIndexAlreadyExists = errors.New("destination index already exists, please delete it first as the CopyIndex cannot hold the responsibility of modifying the destination index")
	ErrSameAppID          = errors.New("indices cannot target the same application ID, please use Client.CopyIndex for same-app index copy instead")
	ErrObjectNotFound     = errors.New("object not found in with search responses' hits list")
)

Functions

func ErrJSONDecode

func ErrJSONDecode(data []byte, t string) error

func IsAlgoliaErrWithCode

func IsAlgoliaErrWithCode(err error, httpCode int) (string, bool)

IsAlgoliaErrWithCode returns the error message along with true if the given error is an AlgoliaErr and its status code matches the given HTTP code. In any other case, an empty string and false are returned.

func NetError

func NetError(err net.Error, msg string) net.Error

Types

type AlgoliaErr

type AlgoliaErr struct {
	Message string `json:"message"`
	Status  int    `json:"status"`
}

AlgoliaErr represents error responses coming from the Algolia Search API when an HTTP call has been sent but the request could not have been processed by the engine.

This error provides more details regarding potential issues with payloads being sent to the API or limits and quotas being reached.

func IsAlgoliaErr

func IsAlgoliaErr(err error) (*AlgoliaErr, bool)

IsAlgoliaErr type-checks the given error against an AlgoliaErr. If the error can be converted, the inner AlgoliaErr is returned along with true. Otherwise, the returned boolean is false and nil is returned.

func (AlgoliaErr) Error

func (e AlgoliaErr) Error() string

Jump to

Keyboard shortcuts

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