error

package
v0.13.0 Latest Latest
Warning

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

Go to latest
Published: May 13, 2025 License: Apache-2.0 Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type E

type E struct {
	// Cause is the cause of the error, if any.
	Cause error
	// Short description of the error.
	Short string
	// Source is the source of the error, if any.
	Source *source
	// Long description of the error.
	Long string
	// Remediation is the remediation for the error, if any.
	Remediation string
}

E is an error type with diagnostic information. It is inspired by Terraform's Diagnostic type.

Unlike Diagnostic, E has no Severity field. That's because in testkit, whether it's an Error or a Warning depends on the context.

In testkit apps, you combine E with log.L and appropriate Level so that the error and diagnostic information are logged according to the log level configured at runtime.

func New

func New(short string, opts ...Option) *E

New creates a new error.

func Wrap

func Wrap(err error, short string, opts ...Option) E

Wrap wraps an error with a new error.

func (E) Error

func (e E) Error() string

func (*E) String

func (e *E) String() string

func (E) Unwrap

func (e E) Unwrap() error

type Option

type Option func(*E)

func Cause

func Cause(err error) Option

func Long

func Long(s string) Option

func Remediation

func Remediation(s string) Option

func Source

func Source(filePath string, lineNum int, lineText string) Option

Jump to

Keyboard shortcuts

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