errors

package
v0.4.2 Latest Latest
Warning

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

Go to latest
Published: Jul 17, 2019 License: Apache-2.0 Imports: 2 Imported by: 0

Documentation

Overview

Package errors defines all exceptions happened in dragonfly.

Package errors defines all exceptions happened in supernode's runtime.

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrDataNotFound represents the data cannot be found..
	ErrDataNotFound = DfError{codeDataNotFound, "data not found"}

	// ErrEmptyValue represents the value is empty or nil.
	ErrEmptyValue = DfError{codeEmptyValue, "empty value"}

	// ErrInvalidValue represents the value is invalid.
	ErrInvalidValue = DfError{codeInvalidValue, "invalid value"}

	// ErrNotInitialized represents the object is not initialized.
	ErrNotInitialized = DfError{codeNotInitialized, "not initialized"}

	// ErrConvertFailed represents failed to convert.
	ErrConvertFailed = DfError{codeConvertFailed, "convert failed"}

	// ErrRangeNotSatisfiable represents the length of file is insufficient.
	ErrRangeNotSatisfiable = DfError{codeRangeNotSatisfiable, "range not satisfiable"}
)
View Source
var (
	// ErrSystemError represents the error is a system error..
	ErrSystemError = DfError{codeSystemError, "system error"}

	// ErrCDNFail represents the cdn status is fail.
	ErrCDNFail = DfError{codeCDNFail, "cdn status is fail"}

	// ErrCDNWait represents the cdn status is wait.
	ErrCDNWait = DfError{codeCDNWait, "cdn status is wait"}

	// ErrPeerWait represents the peer should wait.
	ErrPeerWait = DfError{codePeerWait, "peer should wait"}

	// ErrUnknowError represents the error should not happen
	// and the cause of that is unknown.
	ErrUnknowError = DfError{codeUnknowError, "unknow error"}

	// PeerContinue represents the peer should wait.
	PeerContinue = DfError{codePeerContinue, "peer continue"}

	// ErrURLNotReachable represents the url is a not reachable.
	ErrURLNotReachable = DfError{codeURLNotReachable, "url not reachable"}

	// ErrTaskIDDuplicate represents the task id is in conflict.
	ErrTaskIDDuplicate = DfError{codeTaskIDDuplicate, "taskId conflict"}

	// ErrAuthenticationRequired represents the authentication is required.
	ErrAuthenticationRequired = DfError{codeAuthenticationRequired, "authentication required"}
)

Functions

func IsAuthenticationRequired

func IsAuthenticationRequired(err error) bool

IsAuthenticationRequired check the error is a AuthenticationRequired error or not.

func IsCDNFail

func IsCDNFail(err error) bool

IsCDNFail check the error is CDNFail or not.

func IsCDNWait

func IsCDNWait(err error) bool

IsCDNWait check the error is CDNWait or not.

func IsConvertFailed

func IsConvertFailed(err error) bool

IsConvertFailed check the error is a conversion error or not.

func IsDataNotFound

func IsDataNotFound(err error) bool

IsDataNotFound check the error is the data cannot be found.

func IsEmptyValue

func IsEmptyValue(err error) bool

IsEmptyValue check the error is the value is empty or nil.

func IsInvalidValue

func IsInvalidValue(err error) bool

IsInvalidValue check the error is the value is invalid or not.

func IsNilError

func IsNilError(err error) bool

IsNilError check the error is nil or not.

func IsNotInitialized

func IsNotInitialized(err error) bool

IsNotInitialized check the error is the object is not initialized or not.

func IsPeerContinue

func IsPeerContinue(err error) bool

IsPeerContinue check the error is PeerContinue or not.

func IsPeerWait

func IsPeerWait(err error) bool

IsPeerWait check the error is PeerWait or not.

func IsRangeNotSatisfiable

func IsRangeNotSatisfiable(err error) bool

IsRangeNotSatisfiable check the error is a range not exist error or not.

func IsSystemError

func IsSystemError(err error) bool

IsSystemError check the error is a system error or not.

func IsTaskIDDuplicate

func IsTaskIDDuplicate(err error) bool

IsTaskIDDuplicate check the error is a TaskIDDuplicate error or not.

func IsURLNotReachable

func IsURLNotReachable(err error) bool

IsURLNotReachable check the error is a url not reachable or not.

func IsUnknowError

func IsUnknowError(err error) bool

IsUnknowError check the error is UnknowError or not.

Types

type DfError

type DfError struct {
	Code int
	Msg  string
}

DfError represents a Dragonfly error.

func New

func New(code int, msg string) *DfError

New function creates a DfError.

func Newf

func Newf(code int, format string, a ...interface{}) *DfError

Newf function creates a DfError with a message according to a format specifier.

func (DfError) Error

func (s DfError) Error() string

Jump to

Keyboard shortcuts

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