errort

package
v0.0.0-...-68b20d9 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 8, 2023 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DefaultSuccess                          uint32 = 00000
	DefaultSystemError                      uint32 = 10001
	DefaultJsonParseError                   uint32 = 10002
	DefaultReqParamsError                   uint32 = 10003
	DefaultResourcesNotFound                uint32 = 10004
	DefaultFileNotSpecialSymbol             uint32 = 10005
	DefaultTokenPermission                  uint32 = 10006
	DefaultNameRepeat                       uint32 = 10007
	DefaultNameSpecialCharacters            uint32 = 10008
	DefaultResourcesRepeat                  uint32 = 10009
	DefaultIdEmpty                          uint32 = 10010
	DefaultUploadFileErrorCode                     = 10011
	DefaultReadExcelErrorCode                      = 10012
	DefaultReadExcelErrorParamsRequiredCode        = 10013
	KindDatabaseError                              = 10014
	KindUnknown                                    = 10015
	MqttConnFail                                   = 10016

	AppPasswordError     uint32 = 20101
	AppSystemInitialized uint32 = 20102

	DeviceLibraryMustDeleteDeviceService uint32 = 20201
	DeviceLibraryUpgradeIng              uint32 = 20204
	DeviceLibraryDockerAuthInvalid       uint32 = 20205
	DeviceLibraryDockerImagesNotFound    uint32 = 20206
	DeviceLibraryNotExist                uint32 = 20211
	DeviceLibraryImageDownloadFail       uint32 = 20213
	DeviceLibraryImageNotFound           uint32 = 20214
	DeviceLibraryNotAllowDelete          uint32 = 20215
	DockerImageRepositoryNotFound        uint32 = 20216
	DeviceLibraryResponseTimeOut         uint32 = 20217

	DeviceServiceMustDeleteDevice     uint32 = 20301
	DeviceServiceMustStopService      uint32 = 20302
	DeviceServiceMustStopDoingService uint32 = 20303
	DeviceServiceSetupYamlFormatError uint32 = 20304
	DeviceServiceSendCommandFail      uint32 = 20305
	DeviceServiceNotStarted           uint32 = 20306
	AppServiceMustStopDoingService           = 20307
	AppServiceMustStopService                = DeviceServiceMustStopService
	ContainerRunFail                         = 20308
	DeviceServiceNotExist                    = 20309
	ContainerStopFail                        = 20310
	DockerParamsParseErr                     = 20311
	DeviceServiceContainerNameRepeat         = 20312
	GetAvailablePortFail                     = 20313
	CreateConfigFileFail                     = 20314
	DeviceServiceMustLocalPlatform           = 20315

	DeviceProductIdNotFound             uint32 = 20406
	DeviceDeleteNotAllowed              uint32 = 20407
	DeviceBindAtopFailed                uint32 = 20408
	DeviceUpdateAtopFailed              uint32 = 20409
	DeviceNotExist                             = 20410
	DeviceCommandNotExist                      = 20411
	DeviceNotAllowConnectPlatform              = 20412
	DeviceNotUnbindDriver                      = 20413
	DeviceAndDriverPlatformNotIdentical        = 20414
	DeviceAssociationAlertRule                 = 20415
	DeviceAssociationSceneRule                 = 20416

	// 产品
	ProductMustDeleteDevice     uint32 = 20602
	ProductNotExist             uint32 = 20604
	ProductPropertyCodeNotExist uint32 = 20608
	ProductAssociationAlertRule        = 20611
	ProductUnRelease                   = 20612
	ProductRelease                     = 20613
	ThingModelCodeExist                = 20614

	// 镜像仓库
	DockerConfigMustDeleteDeviceLibrary uint32 = 20701
	DockerConfigNotExist                uint32 = 20702

	CategoryNotExist   uint32 = 21200
	ThingModelNotExist uint32 = 21201

	AlertRuleNotExist              uint32 = 21300
	InvalidRuleJson                uint32 = 21301
	EkuiperNotFindRule             uint32 = 21302
	AlertRuleStatusStarting        uint32 = 21303
	AlertRuleProductOrDeviceUpdate uint32 = 21304
	AlertRuleParamsError           uint32 = 21305
	EffectTimeParamsError          uint32 = 21306
	StopAlertRule                  uint32 = 21307

	SceneTimerIsStartingNotAllowUpdate = 21400

	SceneRuleParamsError uint32 = 21402

	RuleEngineIsStartingNotAllowUpdate = 21500

	InvalidSource = 21600

	CloudServiceConnectionRefused uint32 = 22101
)
View Source
const (
	Success                OpenApiErrorCode = 0
	SystemErrorCode                         = 500
	ParamsError                             = 1104
	FunctionNotSupportCode                  = 2003
	TokenValid                              = 1011
	TokenExpired                            = 1010
	UrlPathIsInvalid                        = 1108
)
View Source
const (
	SystemErrorMsg        OpenApiErrorMsg = "system error,please contact the admin"
	FunctionNotSupportMsg                 = "function not support"
	ParamsErrorMsg                        = "params incorrect"
	TokenValidMsg                         = "token invalid"
	TokenExpiredMsg                       = "token expired"
	UrlPathIsInvalidMsg                   = "url path is invalid"
)

Variables

Functions

func ConvertFromRPC

func ConvertFromRPC(err error) error

ConvertFromRPC 转换GRPC错误码 TODO 已经添加 interceptor 统一处理不需要单独调用

func Is

func Is(code uint32, err error) bool

func Kind

func Kind(err error) uint32

func NewCommonEdgeX

func NewCommonEdgeX(code uint32, message string, wrappedError error) error

NewCommonEdgeX alias NewCommonErr, 建议直接使用 NewCommonErr Deprecated

func NewCommonErr

func NewCommonErr(code uint32, wrappedError error) error

NewCommonErr 封装自定义错误 使用场景: 在底层调用第三方服务或包时需要封装自定义错误

func NewRPCStatusErr

func NewRPCStatusErr(err error) error

NewRPCStatusErr 转换为GRPC错误 TODO 已经添加 interceptor 统一处理不需要单独调用

Types

type CommonEdgeX

type CommonEdgeX struct {
	// contains filtered or unexported fields
}

CommonEdgeX generalizes an error structure which can be used for any type of EdgeX error.

func As

func As(err error) (*CommonEdgeX, bool)

func NewCommonEdgeXWrapper

func NewCommonEdgeXWrapper(wrappedError error) CommonEdgeX

NewCommonEdgeXWrapper 封装自定义错误,1.取出自定义错误,2.未知错误统一使用DefaultSystemError 使用场景: 最上层需要取自定义错误码时调用 Deprecated

func (CommonEdgeX) Cause

func (ce CommonEdgeX) Cause() error

func (CommonEdgeX) Code

func (ce CommonEdgeX) Code() uint32

Code returns the status code of this error.

func (CommonEdgeX) DebugMessages

func (ce CommonEdgeX) DebugMessages() string

DebugMessages returns a string taking all nested and wrapped operations and errors into account.

func (CommonEdgeX) Error

func (ce CommonEdgeX) Error() string

Error creates an error message taking all nested and wrapped errors into account.

func (CommonEdgeX) Is

func (ce CommonEdgeX) Is(err error) bool

Is determines if an error is of type CommonEdgeX. This is used by the new wrapping and unwrapping features available in Go 1.13 and aids the errors.Is function when determining is an error or any error in the wrapped chain contains an error of a particular type.

func (CommonEdgeX) Message

func (ce CommonEdgeX) Message() string

Message returns the first level error message without further details.

func (CommonEdgeX) Unwrap

func (ce CommonEdgeX) Unwrap() error

Unwrap retrieves the next nested error in the wrapped error chain. This is used by the new wrapping and unwrapping features available in Go 1.13 and aids in traversing the error chain of wrapped errors.

type EdgeX

type EdgeX interface {
	// Error obtains the error message associated with the error.
	Error() string
	// DebugMessages returns a detailed string for debug purpose.
	DebugMessages() string
	// Message returns the first level error message without further details.
	Message() string
	// Code returns the status code of this error.
	Code() uint32
}

type OpenApiErrorCode

type OpenApiErrorCode uint32

type OpenApiErrorMsg

type OpenApiErrorMsg string

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL