errors

package
v0.4.2 Latest Latest
Warning

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

Go to latest
Published: Jan 25, 2022 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

View Source
const (
	Tcp110 string = "110"
	Tcp111 string = "111"
	Tcp113 string = "113"
)

TCP socket errors

Variables

View Source
var TcpSocketErrTxt = map[string]string{
	Tcp110: "Connection timed out",
	Tcp111: "connect: connection refused",
	Tcp113: "No route to host",
}

Functions

func AsCommonsError

func AsCommonsError(err error) *commons.Error

func Cause

func Cause(err error) error

Cause returns the cause error of this error

func Detail

func Detail(err error) string

Detail returns the error detail message

func Error

func Error(code ErrorCode, message, detail string) error

Error constructs a new error

func ErrorInternal

func ErrorInternal(code ErrorCode, message, detail string) error

Error constructs a new error

func HttpStatusCode

func HttpStatusCode(err error) int

HttpStatusCode returns the http status code which will be sent to client

func Message

func Message(err error) string

Message returns the error message

func Wrap

func Wrap(err error, code ErrorCode, message, detail string) error

Wrap waps an error with an error and a message

func WrapInternalError

func WrapInternalError(err error, code ErrorCode, message, detail string) error

Wrap waps an error with an error and a message

Types

type ErrorCode

type ErrorCode int32

ErrorCode is data type of error codes for different kind of errors

const (
	ConnectFailed      ErrorCode = -2
	ConnectBroken      ErrorCode = -3
	HttpTimeout        ErrorCode = -4
	DomainLookupFailed ErrorCode = -6
	EmptyResponse      ErrorCode = -404
	CanceledByBrowser  ErrorCode = -5011
	PrecludedByRobots  ErrorCode = -9998
)
const RuntimeException ErrorCode = -5

UnknownError is the unknown error

func Code

func Code(err error) ErrorCode

Code returns the error code

func (ErrorCode) Int32

func (e ErrorCode) Int32() int32

func (ErrorCode) String

func (e ErrorCode) String() string

type ProxyError

type ProxyError struct {
	// contains filtered or unexported fields
}

ProxyError is the struct of recorder proxy error

func (*ProxyError) Cause

func (e *ProxyError) Cause() error

func (*ProxyError) Code

func (e *ProxyError) Code() ErrorCode

func (*ProxyError) Detail

func (e *ProxyError) Detail() string

func (*ProxyError) Error

func (e *ProxyError) Error() string

func (*ProxyError) HttpStatusCode

func (e *ProxyError) HttpStatusCode() string

func (*ProxyError) Message

func (e *ProxyError) Message() string

Jump to

Keyboard shortcuts

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