errorx

package module
v0.0.0-...-dad676c Latest Latest
Warning

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

Go to latest
Published: Apr 21, 2024 License: MIT Imports: 5 Imported by: 1

README

Golang Build Status Coverage Status GoReport Go Reference

usage

import "github.com/ericuni/errorx"

The ericuni/errorx provides an easy way to trace errors without losing the original error context.

The exported New functions are designed to replace the errors.New and fmt.Errorf functions both. The same underlying error is there, but the package also records the location at which the error was created.

A primary use case for this library is to add extra context any time an error is returned from a function.

if err := SomeFunc(); err != nil {
  return err
}

This instead becomes:

if err := SomeFunc(); err != nil {
  return errorx.Trace(err)
}

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Cause

func Cause(err error) error

func New

func New(format string, args ...interface{}) error

New new error

func Trace

func Trace(err error) error

Trace trace

func Tracef

func Tracef(err error, format string, args ...interface{}) error

Tracef trace

Types

This section is empty.

Jump to

Keyboard shortcuts

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