Documentation ¶
Index ¶
- func Breakpoints(value bool)
- func Debugging(value bool)
- func Debugs(msgs ...any) []byte
- func Errors(msgs ...any)
- func Handles(err error) error
- func IOError(err error) bool
- func Informs(msgs ...any)
- func Inspects(msgs ...any)
- func Kills(err error)
- func NewError(err error) error
- func Quiet(outputs ...io.Writer)
- func Success(msgs ...any)
- func Trace()
- func Tracing(value bool)
- func Trap()
- func Warns(msgs ...any)
- type Context
- type Error
- type ErrorContext
- type Presenter
- type Tracer
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Errors ¶
func Errors(msgs ...any)
Errors is syntactic sugar to call the Warning method on a Logger interface.
func IOError ¶
IOError is a specialized error wrapper for IO related errors.
It handles situations where EOF errors should be treated as nil. By returning a boolean value it can be nicely composed within if statements as per the example below.
```
if err := SomeIOTask(); errnie.IOError(err) { return err }
```
func Informs ¶
func Informs(msgs ...any)
Informs is syntactic sugar to call the Info method on a Logger interface.
func Inspects ¶
func Inspects(msgs ...any)
Inspects is syntactic sugar to dump the structure and values of objects with arbitrary complexity to logger output channels.
func Success ¶
func Success(msgs ...any)
Success is syntactic sugar to call the Info method on a Logger interface.
Types ¶
type Context ¶
type Context struct {
// contains filtered or unexported fields
}
Context wraps all state and behavior errnie needs to act as an error handler, logger, and tracer.
func Ctx ¶
func Ctx() *Context
Ctx returns the ambient context for use of its io.ReadWriteCloser interface implementation.
func New ¶
func New() *Context
New constructs and instantiates the ambient context available to errnie internally. Application code can access the instance through the publicly exposed functions.
type Error ¶
type Error struct {
// contains filtered or unexported fields
}
Error is a custom wrapping around Go errors keeping errnie errors fully compatible with conventions.
type ErrorContext ¶
type ErrorContext uint
ErrorContext adds a strongly typed context to the error.
const ( // NIL represents no error was generated. NIL ErrorContext = iota // INTEGRITY represents a failure to verify the integrity of data. INTEGRITY // VALIDATION represents an error during validation of a value. VALIDATION // CONVERSION represents an error while converting a value type. CONVERSION // IOERROR represents a generic IO operation failure. IOERROR // UNKNOWN represents an error with unknown cause. UNKNOWN )