hint

package
v0.8.18 Latest Latest
Warning

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

Go to latest
Published: Aug 7, 2026 License: MPL-2.0 Imports: 5 Imported by: 0

Documentation

Overview

Package hint provides an error wrapping mechanism that allows attaching actionable hints and contextual messages to errors.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Wrap

func Wrap(err error, firstHint string, extraHints ...string) error

Wrap wraps up an error with hints, to help display hints to a user about what might fix the problem.

func Wrapf

func Wrapf(err error, hintf string, args ...any) error

Wrapf wraps an error with a single hint with formatting arguments.

Types

type Error

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

Error is an error that includes hints to be displayed after the error.

func FromError

func FromError(err error) *Error

FromError attempts to parse the given error's string to an *hint.Error.

func (*Error) Error

func (e *Error) Error() string

Error implements [error] interface.

func (*Error) Hint

func (e *Error) Hint() string

Hint returns all hints in a single string separated by a new line.

func (*Error) Message

func (e *Error) Message() string

Message returns the error's message without the hints.

func (*Error) Unwrap added in v0.8.18

func (e *Error) Unwrap() error

Unwrap returns the wrapped error so errors.Is and errors.As can traverse the hint wrapper.

Jump to

Keyboard shortcuts

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