errors

package
v0.26.2 Latest Latest
Warning

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

Go to latest
Published: Jan 4, 2024 License: MPL-2.0 Imports: 4 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrorDelay = fmt.Errorf("Service delay automatically injected")
View Source
var ErrorInjection = fmt.Errorf("Service error automatically injected")
View Source
var ErrorRateLimit = fmt.Errorf("Service exceeded rate limit")

Functions

This section is empty.

Types

type Injector

type Injector struct {
	// contains filtered or unexported fields
}

Injector allows errors and ratelmiting to be injected to a service

func NewInjector

func NewInjector(l hclog.Logger, errorPercentage float64, errorCode int, errorType string, errorDelay time.Duration, rateLimitRPS float64, rateLimitCode int) *Injector

func (*Injector) Do

func (e *Injector) Do() *Response

Do returns an error

func (*Injector) SetErrorPercentage

func (e *Injector) SetErrorPercentage(rate float64)

SetErrorPercentage sets the error rate for the injector must be a floating point number between 0 and 1

type Response

type Response struct {
	Code  int
	Error error
}

Jump to

Keyboard shortcuts

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