common

package
v0.1.2 Latest Latest
Warning

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

Go to latest
Published: Dec 22, 2024 License: MIT Imports: 1 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrNilReceiver occurs when a method is called on a receiver that was not
	// expected to be nil. This error can be checked with the == operator.
	//
	// Format:
	// 	"receiver must not be nil"
	ErrNilReceiver error
)

Functions

func NewErrBadParam

func NewErrBadParam(param_name, reason string) error

NewErrBadParam returns an error with the given parameter name and reason.

Parameters:

  • param_name: The name of the parameter that is invalid.
  • reason: The reason the parameter is invalid.

Returns:

  • error: An instance of ErrBadParam. Never returns nil.

Format:

"parameter (<param_name>) <reason>"

Where:

  • (<param_name>) is the name of the parameter that is invalid. If empty, it is ignored.
  • <reason> is the reason the parameter is invalid. If empty, "is not valid" is used.

func NewErrNilParam

func NewErrNilParam(param_name string) error

NewErrNilParam returns an error with the given parameter name and reason "must not be nil".

Parameters:

  • param_name: The name of the parameter that is invalid.

Returns:

  • error: An instance of ErrBadParam. Never returns nil.

Format:

"parameter (<param_name>) must not be nil"

Where:

  • (<param_name>) is the name of the parameter that is invalid. If empty, it is ignored.

Types

type ErrBadParam

type ErrBadParam struct {
	// ParamName is the name of the parameter that is invalid.
	ParamName string

	// Reason is the reason the parameter is invalid.
	Reason string
}

ErrBadParam occurs when a parameter is not valid.

func (ErrBadParam) Error

func (e ErrBadParam) Error() string

Error implements error.

type Resetter added in v0.1.2

type Resetter interface {
	// Reset resets the object.
	//
	// Returns:
	//   - error: An error if the object could not be reset.
	//
	// Errors:
	//   - common.ErrNilReceiver: If the receiver is nil.
	//   - any other error: Implementation-specific.
	Reset() error
}

Resetter is an interface for objects that can be reset.

Jump to

Keyboard shortcuts

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