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

33 lines
633 B
Go
Raw Normal View History

2020-07-29 19:02:28 +08:00
package rpcutils
import (
"errors"
2023-08-11 16:13:33 +08:00
"fmt"
2020-07-29 19:02:28 +08:00
)
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)
}
2023-08-11 16:13:33 +08:00
return fmt.Errorf("%s: %w", description, err)
2020-09-26 19:54:15 +08:00
}