syserror

package
v1.76.0 Latest Latest
Warning

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

Go to latest
Published: Dec 3, 2026 License: Apache-2.0 Imports: 3 Imported by: 1 module, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package syserror handles "system errors".

A system error is an error that should never actually happen, and should be propagated 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