hintdetail

package
v1.8.6 Latest Latest
Warning

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

Go to latest
Published: Aug 2, 2021 License: Apache-2.0 Imports: 6 Imported by: 7

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func FlattenDetails

func FlattenDetails(err error) string

FlattenDetails retrieves the details as per GetAllDetails() and concatenates them into a single string.

func FlattenHints

func FlattenHints(err error) string

FlattenHints retrieves the hints as per GetAllHints() and concatenates them into a single string.

func GetAllDetails

func GetAllDetails(err error) []string

GetAllDetails retrieves the details from the error using in post-order traversal.

func GetAllHints

func GetAllHints(err error) []string

GetAllHints retrieves the hints from the error using in post-order traversal. The hints are de-duplicated. Assertion failures, issue links and unimplemented errors are detected and receive standard hints.

func WithDetail

func WithDetail(err error, msg string) error

WithDetail decorates an error with a textual detail. The detail may contain PII and thus will not reportable.

Detail is shown: - when formatting with `%+v`. - with `GetAllHints()` / `FlattenHints()` below.

Note: the detail does not appear in the main error message returned with Error(). Use GetAllDetails() or FlattenDetails() to retrieve it.

func WithDetailf

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

WithDetailf is a helper that formats the detail string.

func WithHint

func WithHint(err error, msg string) error

WithHint decorates an error with a textual hint. The hint may contain PII and thus will not reportable.

Hint is shown: - when formatting with `%+v`. - with `GetAllHints()` / `FlattenHints()` below.

Note: the hint does not appear in the main error message returned with Error(). Use GetAllHints() or FlattenHints() to retrieve it.

func WithHintf

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

WithHintf is a helper that formats the hint.

Types

type ErrorDetailer

type ErrorDetailer interface {
	ErrorDetail() string
}

ErrorDetailer is implemented by types that can provide user-informing detail strings. This is implemented by withDetail here and pgerror.Error.

type ErrorHinter

type ErrorHinter interface {
	ErrorHint() string
}

ErrorHinter is implemented by types that can provide user-informing detail strings. This is implemented by withHint here, withIssueLink, assertionFailure and pgerror.Error.

Jump to

Keyboard shortcuts

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