Documentation
¶
Index ¶
- Variables
- func ConvertExitError(err error) error
- func EnhanceError(err error, stdout, stderr string) error
- func HandleCloseError(errp *error, closer io.Closer)
- func IsEOFError(err error) bool
- func IsIgnorableError(err error) bool
- func IsRetriableError(err error) bool
- func JoinErrors(errs ...error) error
- func SafeClose(closer io.Closer) error
- func SafeCloseMultiple(closers ...io.Closer) error
- func WrapError(err error, context string) error
- type ErrorCategory
Constants ¶
This section is empty.
Variables ¶
View Source
var ( // ErrConnectionClosed 表示连接已关闭(正常情况) ErrConnectionClosed = errors.New("connection closed") // ErrSessionClosed 表示会话已关闭(正常情况) ErrSessionClosed = errors.New("session closed") // ErrInvalidConfig 表示配置无效 ErrInvalidConfig = errors.New("invalid configuration") // ErrConnectionFailed 表示连接失败 ErrConnectionFailed = errors.New("connection failed") // ErrAuthFailed 表示认证失败 ErrAuthFailed = errors.New("authentication failed") // ErrCommandFailed 表示命令执行失败 ErrCommandFailed = errors.New("command execution failed") )
预定义的错误类型
Functions ¶
func ConvertExitError ¶
ConvertExitError 将 SSH 退出错误转换为更友好的错误消息
func EnhanceError ¶
EnhanceError 增强错误信息,添加更多上下文
func HandleCloseError ¶
HandleCloseError 处理 defer 中的 close 错误 自动忽略可忽略的错误,合并其他错误到返回值
func SafeCloseMultiple ¶
SafeCloseMultiple 安全地关闭多个资源 返回所有非可忽略的错误的组合
Types ¶
type ErrorCategory ¶
type ErrorCategory int
ErrorCategory 错误分类
const ( // CategoryIgnorable 可忽略的错误(如正常的连接关闭) CategoryIgnorable ErrorCategory = iota // CategoryRetriable 可重试的错误(如临时网络问题) CategoryRetriable // CategoryFatal 致命错误(如认证失败) CategoryFatal )
Click to show internal directories.
Click to hide internal directories.