errors

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Apr 9, 2025 License: MIT Imports: 3 Imported by: 0

Documentation

Overview

Package errors provides a single package for all error-related stuffs and extends the standard library's errors package.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func As

func As(err error, target any) bool

As calls the standard library's errors.As function.

func Errorf

func Errorf(format string, a ...any) error

Errorf calls the standard library's fmt.Errorf function.

func HTTP

func HTTP(status int, err any) error

HTTP wraps err with the specified HTTP status code. err may be either an error or a string. Any other type will cause a panic. If err is a nil error, the return value will also be nil.

func Is

func Is(err, target error) bool

Is calls the standard library's errors.Is function.

func Join

func Join(errs ...error) error

Join calls the standard library's errors.Join function.

func New

func New(text string) error

New returns an error with the supplied message.

func ReadChannel

func ReadChannel(errChan <-chan error) error

ReadChannel reads errors from an errors channel until is closed, and join them.

func StatusCode

func StatusCode(err error) int

StatusCode returns the HTTP status code embedded in the error.

func Unwrap

func Unwrap(err error) error

Unwrap calls the standard library's errors.Unwrap function.

Types

This section is empty.

Jump to

Keyboard shortcuts

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