modulepackage
0.0.0-20170824213838-7d09c0176fd2
Repository: https://github.com/reconquest/hierr-go.git
Documentation: pkg.go.dev
# README
Hierarchical errors made right 
Hate seeing error: exit status 128
in the output of programs without actual
explanation what is going wrong?
Or, maybe, you're more advanced in programming, and use errors concatenation?
can't pull remote 'origin': can't run git fetch 'origin' 'refs/tokens/*:refs/tokens/*': exit status 128
Better, but still unreadable.
hierr
Transform error reports into hierarchy:
can't pull remote 'origin'
└─ can't run git fetch 'origin' 'refs/tokens/*:refs/tokens/*'
└─ exit status 128
To use hierarchy error reporting, just convert fmt.Errorf
calls:
return fmt.Errorf("can't pull remote '%s': %s", remote, err)
→
return hierr.Errorf(err, "can't pull remote '%s'", remote)
# Functions
Context adds context to specified top-level node.
Errorf creates new hierarchy error.
Fatalf creates new hierarchy error, prints to stderr and exit 1
Have same semantics as `hierr.Errorf()`.
Push creates new hierarchy error with multiple branches separated by separator, delimited by delimiter and prolongated by prolongator.
No description provided by the author
# Constants
BranchChainerASCII represents a simple ASCII chainer for hierarchy branches.
BranchChainerBox represents UTF8 chainer for hierarchy branches.
BranchDelimiterASCII represents a simple ASCII delimiter for hierarchy branches.
BranchDelimiterBox represents UTF8 delimiter for hierarchy branches.
BranchSplitterASCII represents a simple ASCII splitter for hierarchy branches.
BranchSplitterBox represents UTF8 splitter for hierarchy branches.
# Variables
BranchChainer set chainer each nested error tree text will be started from.
BranchDelimiter set delimiter each nested error text will be started from.
BranchIndent set number of spaces each nested error will be indented by.
BranchSplitter set splitter each nested errors splitted by.
# Interfaces
HierarchicalError represents interface, which methods will be used instead of calling String() and Error() methods.
NestedError is either `error` or string.