diagnostics

package
v1.14.16-dcf8320c8c4e Latest Latest
Warning

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

Go to latest
Published: Sep 12, 2024 License: Apache-2.0 Imports: 6 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Err

type Err struct {
	Orig error

	// Source defines with entity is generating the error.
	// It allows passing along information about where the error is being
	// generated from. for example, the Asset.
	Source string

	// Reason is a CamelCase string that summarizes the error in one word.
	// It allows easy catgeorizations of known errors.
	Reason string

	// Message is free-form strings which provides important details or
	// diagnostics for the error. When writing messages, make sure to keep in mind
	// that the audience for message is end-users who might not be experts.
	Message string
}

Err wraps diagnostics information for an error. Err allows providing information like source, reason and message that provides a much better user error reporting capability.

func (*Err) Error

func (e *Err) Error() string

Error returns a string representation of the Err. The returned value is expected to be a single value. The format of the error string returned is, `error(<Reason>) from <Source>: <Message>: <Cause of Orig>`

func (*Err) Print

func (e *Err) Print(w io.Writer)

Print prints the Err to Writer in a way that is more verbose and sectionalized. The output looks like: Error from <Source>: Reason: <reason>

Message: <Message>

Original: <Orig>

func (*Err) Unwrap

func (e *Err) Unwrap() error

Unwrap allows the error to be unwrapped.

Jump to

Keyboard shortcuts

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