errors

package
v0.3.1 Latest Latest
Warning

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

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

Documentation

Overview

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

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrInvalidValue represents the value is invalid.
	ErrInvalidValue = &DFGetError{codeInvalidValue, "invalid value"}

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

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

	// ErrRangeNotSatisfiable represents the length of file is insufficient.
	ErrRangeNotSatisfiable = &DFGetError{codeRangeNotSatisfiable, "range not satisfiable"}
)

Functions

func IsConvertFailed

func IsConvertFailed(err error) bool

IsConvertFailed check the error is a conversion error or not.

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 IsRangeNotSatisfiable

func IsRangeNotSatisfiable(err error) bool

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

Types

type DFGetError

type DFGetError struct {
	Code int
	Msg  string
}

DFGetError represents a error created by dfget.

func New

func New(code int, msg string) *DFGetError

New function creates a DFGetError.

func Newf

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

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

func (*DFGetError) Error

func (e *DFGetError) Error() string

Jump to

Keyboard shortcuts

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