common

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Dec 8, 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 is nil. This
	// error can be checked with the == operator.
	//
	// Format:
	// 	"receiver must not be nil"
	ErrNilReceiver error
)

Functions

func NewErrBadParam

func NewErrBadParam(name, msg string) error

NewErrBadParam creates and returns a new ErrBadParam error with the specified parameter name and error message.

Parameters:

  • name: The name of the parameter.
  • msg: The error message.

Returns:

  • error: A pointer to the newly created ErrBadParam. Never returns nil.

Format:

"parameter (<name>) <msg>"

Where:

  • <name> is the name of the parameter. If empty, it is omitted.
  • <msg> is the error message. If empty, defaults to "is not valid".

func NewErrNilParam

func NewErrNilParam(name string) error

NewErrNilParam creates and returns a new ErrBadParam error with the specified parameter name and error message "must not be nil".

Parameters:

  • name: The name of the parameter.

Returns:

  • error: A pointer to the newly created ErrBadParam. Never returns nil.

Format:

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

Where, <name> is the name of the parameter. If empty, it is omitted.

Types

type ErrBadParam

type ErrBadParam struct {
	// Name is the name of the parameter.
	Name string

	// Msg is the error message.
	Msg string
}

ErrBadParam occurs when a parameter is not valid.

func (ErrBadParam) Error

func (e ErrBadParam) Error() string

Error implements error.

Jump to

Keyboard shortcuts

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