syserror

package
v1.47.2 Latest Latest
Warning

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

Go to latest
Published: Nov 14, 2024 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Overview

Package syserror handles "system errors".

A system error is an error that should never actually happen, and should be propogated to the user as a bug in the codebase. System errors are generally defensive-programming assertions that we want to check for in our codebase.

If a system error occurs, you may want to send a specialized help that says how to file a bug report.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Is

func Is(err error) bool

Is is a convenience function that returns true if err is a system error.

func Wrap

func Wrap(err error) error

Wrap returns a new system error for err.

If err is already a system error, this returns err.

Types

type Error

type Error struct {
	Underlying error
}

Error is a system error.

func As

func As(err error) (*Error, bool)

As is a convenience function that returns err as an Error and true if err is an Error, and err and false otherwise.

func New

func New(text string) *Error

New is a convenience function that returns a new system error by calling errors.new.

func Newf

func Newf(format string, args ...any) *Error

Newf is a convenience function that returns a new system error by calling fmt.Errorf.

func (*Error) Error

func (e *Error) Error() string

Error implements error.

func (*Error) Unwrap

func (e *Error) Unwrap() error

Unwrap implements errors.Unwrap for Error.

Jump to

Keyboard shortcuts

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