Files
EdgeAPI/internal/rpc/utils/utils.go

32 lines
632 B
Go
Raw Normal View History

2020-07-29 19:02:28 +08:00
package rpcutils
import (
"errors"
)
type UserType = string
const (
2021-04-13 20:01:21 +08:00
UserTypeNone = "none"
UserTypeAdmin = "admin"
UserTypeUser = "user"
UserTypeProvider = "provider"
UserTypeNode = "node"
UserTypeCluster = "cluster"
UserTypeMonitor = "monitor"
UserTypeStat = "stat"
UserTypeDNS = "dns"
UserTypeLog = "log"
UserTypeAPI = "api"
UserTypeAuthority = "authority"
UserTypeReport = "report"
2020-07-29 19:02:28 +08:00
)
2021-04-13 20:01:21 +08:00
// Wrap 包装错误
2020-09-26 19:54:15 +08:00
func Wrap(description string, err error) error {
if err == nil {
return errors.New(description)
}
return errors.New(description + ": " + err.Error())
}