go-burrito

module
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Nov 20, 2022 License: MIT

README

go-burrito

Simple, fast, and easy to use library for handling errors.

Installation

go get github.com/Bedrock-OSS/go-burrito

Usage

package main

import (
	"fmt"
	"github.com/Bedrock-OSS/go-burrito/burrito"
)

func main() {
	burrito.Debug = true
	err := burrito.WrappedError("This is a root error")
	err = burrito.WrapErrorf(err, "We failed to do Y and we can provide the cause")
	err = burrito.WrapErrorf(err, "We failed to do X and we can provide the cause")
	fmt.Println(err)
}

This will output:

We failed to do X and we can provide the cause
[+]: We failed to do Y and we can provide the cause
[+]: This is a root error

Setting burrito.Debug to true will also output the stack trace for the error:

We failed to do X and we can provide the cause
[+]: We failed to do Y and we can provide the cause
[+]: This is a root error
   [main.main] main.go:10
   [main.main] main.go:11
   [main.main] main.go:12

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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