pcserror

package
v0.0.0-...-3404eb1 Latest Latest
Warning

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

Go to latest
Published: Dec 29, 2021 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Overview

Package pcserror PCS错误包

Index

Constants

View Source
const (
	// StrSuccess 操作成功
	StrSuccess = "操作成功"
	// StrInternalError 内部错误
	StrInternalError = "内部错误"
	// StrRemoteError 远端服务器返回错误
	StrRemoteError = "远端服务器返回错误"
	// StrNetError 网络错误
	StrNetError = "网络错误"
	// StrJSONParseError json 数据解析失败
	StrJSONParseError = "json 数据解析失败"
)

Variables

This section is empty.

Functions

func FindPanErr

func FindPanErr(errno int) (errmsg string)

FindPanErr 根据 ErrNo, 解析网盘错误信息

Types

type DlinkErrInfo

type DlinkErrInfo struct {
	Operation string
	ErrType   ErrType
	Err       error
	ErrNo     int    `json:"errno"`
	Msg       string `json:"msg"`
}

DlinkErrInfo dlink服务器错误信息

func NewDlinkErrInfo

func NewDlinkErrInfo(op string) *DlinkErrInfo

NewDlinkErrInfo 初始化DlinkErrInfo

func (*DlinkErrInfo) Error

func (dle *DlinkErrInfo) Error() string

func (*DlinkErrInfo) GetErrType

func (dle *DlinkErrInfo) GetErrType() ErrType

GetErrType 获取错误类型

func (*DlinkErrInfo) GetError

func (dle *DlinkErrInfo) GetError() error

GetError 获取原始错误

func (*DlinkErrInfo) GetOperation

func (dle *DlinkErrInfo) GetOperation() string

GetOperation 获取操作

func (*DlinkErrInfo) GetRemoteErrCode

func (dle *DlinkErrInfo) GetRemoteErrCode() int

GetRemoteErrCode 获取远端服务器错误代码

func (*DlinkErrInfo) GetRemoteErrMsg

func (dle *DlinkErrInfo) GetRemoteErrMsg() string

GetRemoteErrMsg 获取远端服务器错误消息

func (*DlinkErrInfo) SetJSONError

func (dle *DlinkErrInfo) SetJSONError(err error)

SetJSONError 设置JSON错误

func (*DlinkErrInfo) SetNetError

func (dle *DlinkErrInfo) SetNetError(err error)

SetNetError 设置网络错误

func (*DlinkErrInfo) SetRemoteError

func (dle *DlinkErrInfo) SetRemoteError()

SetRemoteError 设置远端服务器错误

type ErrType

type ErrType int

ErrType 错误类型

const (
	// ErrorTypeNoError 无错误
	ErrorTypeNoError ErrType = iota
	// ErrTypeInternalError 内部错误
	ErrTypeInternalError
	// ErrTypeRemoteError 远端服务器返回错误
	ErrTypeRemoteError
	// ErrTypeNetError 网络错误
	ErrTypeNetError
	// ErrTypeJSONParseError json 数据解析失败
	ErrTypeJSONParseError
	// ErrTypeOthers 其他错误
	ErrTypeOthers
)

type Error

type Error interface {
	error
	SetJSONError(err error)
	SetNetError(err error)
	SetRemoteError()
	GetOperation() string
	GetErrType() ErrType
	GetRemoteErrCode() int
	GetRemoteErrMsg() string
	GetError() error
}

Error 错误信息接口

func DecodePCSJSONError

func DecodePCSJSONError(opreation string, data io.Reader) Error

DecodePCSJSONError 解析PCS JSON的错误

func DecodePanJSONError

func DecodePanJSONError(opreation string, data io.Reader) Error

DecodePanJSONError 解析Pan JSON的错误

func HandleJSONParse

func HandleJSONParse(op string, data io.Reader, info interface{}) (pcsError Error)

HandleJSONParse 处理解析json

type PCSErrInfo

type PCSErrInfo struct {
	Operation string // 正在进行的操作
	ErrType   ErrType
	Err       error
	ErrCode   int    `json:"error_code"` // 错误代码
	ErrMsg    string `json:"error_msg"`  // 错误消息
}

PCSErrInfo PCS错误信息

func NewPCSErrorInfo

func NewPCSErrorInfo(operation string) *PCSErrInfo

NewPCSErrorInfo 提供operation操作名称, 返回 *PCSErrInfo

func (*PCSErrInfo) Error

func (pcse *PCSErrInfo) Error() string

func (*PCSErrInfo) GetErrType

func (pcse *PCSErrInfo) GetErrType() ErrType

GetErrType 获取错误类型

func (*PCSErrInfo) GetError

func (pcse *PCSErrInfo) GetError() error

GetError 获取原始错误

func (*PCSErrInfo) GetOperation

func (pcse *PCSErrInfo) GetOperation() string

GetOperation 获取操作

func (*PCSErrInfo) GetRemoteErrCode

func (pcse *PCSErrInfo) GetRemoteErrCode() int

GetRemoteErrCode 获取远端服务器错误代码

func (*PCSErrInfo) GetRemoteErrMsg

func (pcse *PCSErrInfo) GetRemoteErrMsg() string

GetRemoteErrMsg 获取远端服务器错误消息

func (*PCSErrInfo) SetJSONError

func (pcse *PCSErrInfo) SetJSONError(err error)

SetJSONError 设置JSON错误

func (*PCSErrInfo) SetNetError

func (pcse *PCSErrInfo) SetNetError(err error)

SetNetError 设置网络错误

func (*PCSErrInfo) SetRemoteError

func (pcse *PCSErrInfo) SetRemoteError()

SetRemoteError 设置远端服务器错误

type PanErrorInfo

type PanErrorInfo struct {
	Operation string
	ErrType   ErrType
	Err       error
	ErrNo     int `json:"errno"`
}

PanErrorInfo 网盘网页的api错误

func NewPanErrorInfo

func NewPanErrorInfo(operation string) *PanErrorInfo

NewPanErrorInfo 提供operation操作名称, 返回 *PanErrorInfo

func (*PanErrorInfo) Error

func (pane *PanErrorInfo) Error() string

func (*PanErrorInfo) GetErrType

func (pane *PanErrorInfo) GetErrType() ErrType

GetErrType 获取错误类型

func (*PanErrorInfo) GetError

func (pane *PanErrorInfo) GetError() error

GetError 获取原始错误

func (*PanErrorInfo) GetOperation

func (pane *PanErrorInfo) GetOperation() string

GetOperation 获取操作

func (*PanErrorInfo) GetRemoteErrCode

func (pane *PanErrorInfo) GetRemoteErrCode() int

GetRemoteErrCode 获取远端服务器错误代码

func (*PanErrorInfo) GetRemoteErrMsg

func (pane *PanErrorInfo) GetRemoteErrMsg() string

GetRemoteErrMsg 获取远端服务器错误消息

func (*PanErrorInfo) SetJSONError

func (pane *PanErrorInfo) SetJSONError(err error)

SetJSONError 设置JSON错误

func (*PanErrorInfo) SetNetError

func (pane *PanErrorInfo) SetNetError(err error)

SetNetError 设置网络错误

func (*PanErrorInfo) SetRemoteError

func (pane *PanErrorInfo) SetRemoteError()

SetRemoteError 设置远端服务器错误

Jump to

Keyboard shortcuts

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