mirror of
https://github.com/kubevela/kubevela.git
synced 2026-03-05 19:22:03 +00:00
* 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>
28 lines
655 B
Go
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
|
|
}
|