errors

package
v0.9.0 Latest Latest
Warning

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

Go to latest
Published: Jun 19, 2026 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) *commonsV1.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
	RuntimeException   ErrorCode = -5
	DomainLookupFailed ErrorCode = -6
	EmptyResponse      ErrorCode = -404
	CanceledByBrowser  ErrorCode = -5011
	PrecludedByRobots  ErrorCode = -9998
)

See https://heritrix.readthedocs.io/en/latest/glossary.html for the original Heritrix error codes.

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() int

func (*ProxyError) Message

func (e *ProxyError) Message() string

func (*ProxyError) Unwrap added in v0.8.0

func (e *ProxyError) Unwrap() error

Jump to

Keyboard shortcuts

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