package instance12import "fmt"34// ErrInvalidUpdate is returned whenever Update is called against an instance5// but an invalid field is changed between configs. If ErrInvalidUpdate is6// returned, the instance must be fully stopped and replaced with a new one7// with the new config.8type ErrInvalidUpdate struct {9Inner error10}1112// Error implements the error interface.13func (e ErrInvalidUpdate) Error() string { return e.Inner.Error() }1415// Is returns true if err is an ErrInvalidUpdate.16func (e ErrInvalidUpdate) Is(err error) bool {17switch err.(type) {18case ErrInvalidUpdate, *ErrInvalidUpdate:19return true20default:21return false22}23}2425// As will set the err object to ErrInvalidUpdate provided err26// is a pointer to ErrInvalidUpdate.27func (e ErrInvalidUpdate) As(err interface{}) bool {28switch v := err.(type) {29case *ErrInvalidUpdate:30*v = e31default:32return false33}34return true35}3637// errImmutableField is the error describing a field that cannot be changed. It38// is wrapped inside of a ErrInvalidUpdate.39type errImmutableField struct{ Field string }4041func (e errImmutableField) Error() string {42return fmt.Sprintf("%s cannot be changed dynamically", e.Field)43}444546