gore

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

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

Go to latest
Published: Jun 14, 2015 License: MIT Imports: 4 Imported by: 2

README

gore – helper for error with details

Usage
err := gore.New("hello")
gore.Append(err, "Some context message")
gore.Appendf(err, "Another formatted context massage %s", "for define this error")

gerr := err.(*Err)
log.Print(gerr.Caller.ShortFileName())

See for examples gore_test.go

Install
go get github.com/kavkaz/gore

Documentation

Overview

Package gore implement functions for detail errors

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Caller

type Caller struct {
	FuncName string
	FileName string
	Line     int
}

Caller struct store info about caller

func NewCaller

func NewCaller(lvl int) *Caller

func (*Caller) ShortFileName

func (caller *Caller) ShortFileName() string

func (*Caller) ShortFuncName

func (caller *Caller) ShortFuncName() string

type Context

type Context struct {
	Caller *Caller
	Msg    string
}

Context struct store info about call context

func (*Context) String

func (c *Context) String() string

String representation of Context object

type Err

type Err struct {
	Msg     string
	Caller  *Caller
	Context []*Context
}

Err struct implement of error

func Append

func Append(e error, args ...interface{}) *Err

Append method append Context to given Err object

func Appendf

func Appendf(e error, format string, args ...interface{}) *Err

func New

func New(text string) *Err

New returns an error with caller details

func Newf

func Newf(text string, args ...interface{}) *Err

Newf returns an error with formatting message and caller details

func (*Err) Append

func (err *Err) Append(args ...interface{}) *Err

func (*Err) Appendf

func (err *Err) Appendf(format string, args ...interface{}) *Err

func (*Err) Error

func (err *Err) Error() string

Error return string for Err object

Jump to

Keyboard shortcuts

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