protocolerrors

package
v1.0.5 Latest Latest
Warning

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

Go to latest
Published: Sep 26, 2024 License: ISC Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ConvertToBanningProtocolErrorIfRuleError

func ConvertToBanningProtocolErrorIfRuleError(err error, format string, args ...interface{}) error

ConvertToBanningProtocolErrorIfRuleError converts the given error to a banning protocol error if it's a rule error, and otherwise keep it as is.

func Errorf

func Errorf(shouldBan bool, format string, args ...interface{}) error

Errorf formats according to a format specifier and returns the string as a ProtocolError.

func New

func New(shouldBan bool, message string) error

New returns a ProtocolError with the supplied message. New also records the stack trace at the point it was called.

func Wrap

func Wrap(shouldBan bool, err error, message string) error

Wrap wraps the given error and returns it as a ProtocolError.

func Wrapf

func Wrapf(shouldBan bool, err error, format string, args ...interface{}) error

Wrapf wraps the given error with the given format and returns it as a ProtocolError.

Types

type ProtocolError

type ProtocolError struct {
	ShouldBan bool
	Cause     error
}

ProtocolError is an error that signifies a violation of the peer-to-peer protocol

func (ProtocolError) Error

func (e ProtocolError) Error() string

func (ProtocolError) Unwrap

func (e ProtocolError) Unwrap() error

Unwrap returns the cause of ProtocolError, to be used with `errors.Unwrap()`

Jump to

Keyboard shortcuts

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