warning

package
v0.31.3 Latest Latest
Warning

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

Go to latest
Published: Nov 21, 2024 License: Apache-2.0 Imports: 1 Imported by: 27

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AddWarning

func AddWarning(ctx context.Context, agent string, text string)

AddWarning records a warning for the specified agent and text to the Recorder added to the provided context using WithWarningRecorder(). If no Recorder exists in the provided context, this is a no-op. agent must be valid UTF-8, and must not contain spaces, quotes, backslashes, or control characters. text must be valid UTF-8, and must not contain control characters.

func WithWarningRecorder

func WithWarningRecorder(ctx context.Context, recorder Recorder) context.Context

WithWarningRecorder returns a new context that wraps the provided context and contains the provided Recorder implementation. The returned context can be passed to AddWarning().

Types

type Recorder

type Recorder interface {
	// AddWarning adds the specified warning to the response.
	// agent must be valid UTF-8, and must not contain spaces, quotes, backslashes, or control characters.
	// text must be valid UTF-8, and must not contain control characters.
	AddWarning(agent, text string)
}

Recorder provides a method for recording warnings

Jump to

Keyboard shortcuts

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