Documentation ¶
Index ¶
- func FlattenDetails(err error) string
- func FlattenHints(err error) string
- func GetAllDetails(err error) []string
- func GetAllHints(err error) []string
- func WithDetail(err error, msg string) error
- func WithDetailf(err error, format string, args ...interface{}) error
- func WithHint(err error, msg string) error
- func WithHintf(err error, format string, args ...interface{}) error
- type ErrorDetailer
- type ErrorHinter
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func FlattenDetails ¶
FlattenDetails retrieves the details as per GetAllDetails() and concatenates them into a single string.
func FlattenHints ¶
FlattenHints retrieves the hints as per GetAllHints() and concatenates them into a single string.
func GetAllDetails ¶
GetAllDetails retrieves the details from the error using in post-order traversal.
func GetAllHints ¶
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 ¶
WithDetail decorates an error with a textual detail. The detail may contain PII and thus will not reportable. The suggested use case for detail is to augment errors with information useful for debugging.
Detail is shown: - when formatting with `%+v`. - with `GetAllDetails()` / `FlattenDetails()` below.
Note: the detail does not appear in the main error message returned with Error(). Use GetAllDetails() or FlattenDetails() to retrieve it.
func WithDetailf ¶
WithDetailf is a helper that formats the detail string.
func WithHint ¶
WithHint decorates an error with a textual hint. The hint may contain PII and thus will not reportable. The suggested use case for hint is to relay information to end users.
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.
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.