/conerror

Provides contextual errors.

Primary LanguageGoApache License 2.0Apache-2.0

conerror

import "github.com/jlaswell/conerror"

Overview

Package conerror provides contextual errors.

Index

Package files

error.go

type ConError

type ConError interface {
    error

    // Get contextual information.
    Get(key interface{}) interface{}
    // Set contextual information.
    Set(key, val interface{})
}

ConError is a contextual error. It can be used as a std error and to hold extra information via the Get() and Set() methods available.

func New

func New(text string) ConError

New create a new ConError from an error message.

func NewFromError

func NewFromError(err error) ConError

NewFromError creates a new ConError from an error.

type Error

type Error struct {
    // contains filtered or unexported fields
}

Error provides an implementation of the ConError interface.

func (*Error) Error

func (e *Error) Error() string

Error returns the message for this error.

func (*Error) Get

func (e *Error) Get(key interface{}) interface{}

Get contextual information.

func (*Error) Set

func (e *Error) Set(key, val interface{})

Set contextual information.


Generated by godoc2md