Files
kubevela/pkg/addon/error.go
barnettZQG ba1f8e4793 Feat: change the model to support multiple environments (#2721)
* Feat: change swagger config

* Feat: change the model to support multiple environments.

* Feat: support query targets by namespace

* Fix: fix definition unit test case

Co-authored-by: barnettZQG <yiyun.pro>
2021-11-16 14:45:49 +08:00

28 lines
655 B
Go

package addon
import (
"github.com/google/go-github/v32/github"
"github.com/pkg/errors"
)
// NewAddonError will return an
func NewAddonError(msg string) error {
return errors.New(msg)
}
var (
// ErrRenderCueTmpl is error when render addon's cue file
ErrRenderCueTmpl = NewAddonError("fail to render cue tmpl")
// ErrRateLimit means exceed github access rate limit
ErrRateLimit = NewAddonError("exceed github access rate limit")
)
// WrapErrRateLimit return ErrRateLimit if is the situation, or return error directly
func WrapErrRateLimit(err error) error {
if errors.As(err, &github.RateLimitError{}) {
return ErrRateLimit
}
return err
}