perrors

package
v0.3.1 Latest Latest
Warning

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

Go to latest
Published: Jun 27, 2026 License: MIT Imports: 4 Imported by: 0

Documentation

Overview

Package perrors provides error handling for pgxcli.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Wrap

func Wrap(err error, opts ...Option) error

Wrap makes an error with details, mainly used for logging.

Types

type ErrDetailed

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

ErrDetailed is an error with details, mainly used for logging.

func (ErrDetailed) Details

func (e ErrDetailed) Details() iter.Seq2[string, any]

Details returns the details of an ErrDetailed as a sequence of key-value pairs.

func (ErrDetailed) Error

func (e ErrDetailed) Error() string

Error implements error.

func (ErrDetailed) Exit

func (e ErrDetailed) Exit() int

Exit gets the exit code of an error, if available.

func (ErrDetailed) Messages

func (e ErrDetailed) Messages() []string

Messages returns the messages of an ErrDetailed.

func (ErrDetailed) Output

func (e ErrDetailed) Output() string

Output returns the output of an ErrDetailed.

func (ErrDetailed) Unwrap

func (e ErrDetailed) Unwrap() error

Unwrap implements unwrap.

type Option

type Option func(*ErrDetailed)

Option changes things in an ErrDetailed.

func WithDetails

func WithDetails(pairs ...any) Option

WithDetails adds details to an ErrDetailed.

Details are key-value pairs, so the number of arguments should be even.

func WithExit

func WithExit(exit int) Option

WithExit sets the exit code in an ErrDetailed.

func WithMessage

func WithMessage(message string) Option

WithMessage adds a message to an ErrDetailed.

func WithOutput

func WithOutput(output string) Option

WithOutput sets the output in an ErrDetailed.

Jump to

Keyboard shortcuts

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