errcode

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Mar 27, 2022 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

View Source
const (
	//StartFailed start failed with reason which we have not classify
	StartFailed = 1000 + iota
	InvalidAccount
	ConfigLoadFailed
	EngineStartFailed
	CreateTunFailed
	TunUpdateFailed
	NetMapRefreshFailed
)

NOTE: notify error to mobile platform, don't delete any item and resort the order.

Variables

View Source
var (
	ErrVersionMissing       = withcode(errors.New("version header is missing"), InvalidVersion)
	ErrMajorVersionMismatch = withcode(errors.New("major version mismatch"), IncompatibleVersion)
	ErrInvalidAuthKey       = fn.ErrorWithStatusCode(withcode(errors.New("invalid authentication privateKey"), InvalidSecretKey), http.StatusUnauthorized)
	ErrInvalidToken         = fn.ErrorWithStatusCode(withcode(errors.New("invalid token"), InvalidToken), http.StatusForbidden)
	ErrServerInternal       = withcode(errors.New("server internal error"), InternalError)
	ErrNotFound             = withcode(errors.New("not found"), NotFound)
	ErrIllegalRequest       = withcode(errors.New("illegal request"), IllegalRequest)
	ErrIllegalOperation     = withcode(errors.New("illegal operation"), IllegalOperation)
	ErrDeviceExceed         = withcode(errors.New("device exceed"), DeviceExceed)
)

Functions

This section is empty.

Types

type ErrCode

type ErrCode int
const (
	InternalError ErrCode = 1 + iota
	InvalidVersion
	IncompatibleVersion
	InvalidSecretKey
	NotFound
	InvalidToken
	IllegalRequest
	IllegalOperation
	DeviceExceed
)

NOTE: don't delete any item and resort the order.

type Error

type Error struct {
	Code ErrCode
	Err  error
}

Error represent a dedicated error type, which contain the API status code

func (Error) Error

func (e Error) Error() string

Error implements the error interface

func (Error) Unwrap

func (e Error) Unwrap() error

Jump to

Keyboard shortcuts

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