cerrors

package
v0.7.3 Latest Latest
Warning

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

Go to latest
Published: Mar 14, 2023 License: MIT Imports: 5 Imported by: 12

Documentation

Overview

Package cerrors provides a custom error type that can hold more context than the stdlib error package.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func New

func New(cause error, msg string, tags map[string]interface{}) error

New creates an error by (optionally) wrapping an existing error and annotating the error with structured tags.

func WithTags

func WithTags(err error, tags map[string]interface{}) error

WithTags annotates an existing error with structured tags.

Types

type Error

type Error struct {
	Message string
	Tags    map[string]interface{}
	Cause   error
}

Error can wrap an error with additional context such as structured tags.

func (Error) Error

func (e Error) Error() string

Error returns a human-friendly string that contains the entire error chain along with all of the tags on each error.

func (Error) Unwrap

func (e Error) Unwrap() error

Unwrap returns the underlying cause of an error (if any).

Jump to

Keyboard shortcuts

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