errors

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Jul 28, 2024 License: MIT Imports: 5 Imported by: 0

Documentation

Overview

Package errors extends https://github.com/pkg/errors

Index

Examples

Constants

This section is empty.

Variables

View Source
var As = errors.As
View Source
var Is = errors.Is
View Source
var Unwrap = errors.Unwrap

Functions

func Cause

func Cause(err error) error

func Join

func Join(errs ...error) error

func New

func New(a ...any) error

func Newf added in v0.3.0

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

func Wrap

func Wrap(cause error, a ...any) error
Example
package main

import (
	"fmt"

	"github.com/cancue/gommon/errors"
)

func main() {
	if err := func() error {
		// Do something...
		return errors.New("error!")
	}(); err != nil {
		wrapped := errors.Wrap(err, "doing something")
		fmt.Println(wrapped)
	}

}
Output:

doing something: error!

func Wrapf added in v0.3.0

func Wrapf(cause error, format string, a ...any) error

Types

type Joined

type Joined []error

func (Joined) Error

func (errs Joined) Error() string

Jump to

Keyboard shortcuts

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