usererr

package
v0.0.0-...-b872246 Latest Latest
Warning

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

Go to latest
Published: Oct 14, 2023 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Extract

func Extract(err error) (error, bool)

Extract unwraps and returns the user error if it exists.

func IsWarning

func IsWarning(err error) bool

func New

func New(msg string, args ...any) error

New creates new user error with the given message. By default these errors are not logged to Sentry. If you want to log the error, use NewLogged

func NewExecError

func NewExecError(source error) error

func NewLogged

func NewLogged(msg string, args ...any) error

NewLogged creates new user error with the given message. These messages are logged to Sentry without the message (for privacy reasons). This is useful for unexpected errors that we want to make sure to log but we also want to attach a good human readable message to.

func NewWarning

func NewWarning(msg string, args ...any) error

func ShouldLogError

func ShouldLogError(err error) bool

ShouldLogError returns true if the it's a logged user error or is a non-user error

func WithLoggedUserMessage

func WithLoggedUserMessage(source error, msg string, args ...any) error

func WithUserMessage

func WithUserMessage(source error, msg string, args ...any) error

Types

type ExitError

type ExitError struct {
	*exec.ExitError
}

ExitError is an ExitError for a command run on behalf of a user

Notes

Bugs

  • exec.Cmd.Run can return other error types, such as when the binary path isn't found. Those should still be considered a user exec error and not reported to Sentry.

Jump to

Keyboard shortcuts

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