Movatterモバイル変換


[0]ホーム

URL:


vizerror

package
v1.92.2Latest Latest
Warning

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

Go to latest
Published: Dec 10, 2025 License:BSD-3-ClauseImports:2Imported by:4

Details

Repository

github.com/tailscale/tailscale

Links

Documentation

Overview

Package vizerror provides types and utility funcs for handling visible errorsthat are safe to display to end users.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

funcErrorf

func Errorf(publicMsgFormatstring, a ...any)error

Errorf returns an Error with the specified publicMsgFormat and values. It always returns a vizerror.Error.

Warning: avoid using an error as one of the format arguments, as this will cause the textof that error to be displayed to the end user (which is probably not what you want).

funcNew

func New(publicMsgstring)error

New returns an error that formats as the given text. It always returns a vizerror.Error.

funcWrapdeprecated

func Wrap(publicErrerror)error

Wrap wraps publicErr with a vizerror.Error.

Deprecated: this is almost always the wrong thing to do. Are you really sureyou know exactly what err.Error() will stringify to and be safe to show tousers?WrapWithMessage is probably what you want.

funcWrapWithMessageadded inv1.76.0

func WrapWithMessage(wrappederror, publicMsgstring)error

WrapWithMessage wraps the given error with a message that's safe to displayto end users. The text of the wrapped error will not be displayed to endusers.

WrapWithMessage should almost always be preferred toWrap.

Types

typeError

type Error struct {// contains filtered or unexported fields}

Error is an error that is safe to display to end users.

funcAs

func As(errerror) (eError, okbool)

As returns the first vizerror.Error in err's chain.

func (Error)Error

func (eError) Error()string

Error implements the error interface. The returned string is safe to displayto end users.

func (Error)Unwrap

func (eError) Unwrap()error

Unwrap returns the underlying error.

If the Error was constructed usingWrapWithMessage, this is the wrapped (internal) errorand not the user-visible error message.

Source Files

View all Source files

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f orF : Jump to
y orY : Canonical URL
go.dev uses cookies from Google to deliver and enhance the quality of its services and to analyze traffic.Learn more.

[8]ページ先頭

©2009-2025 Movatter.jp