Skip to content
/ decrr Public

Error decorator that returns native error type in Go

License

Notifications You must be signed in to change notification settings

aldy505/decrr

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Decrr

Go Reference Go Report Card GitHub CodeFactor codecov Codacy Badge Test

A modification (and a bit of simplification) of the tracerr package.

This essentially does pretty much the same, but instead of returning another struct like tracerr package does, this decorate the error and return another regular error type.

Usage

Simply put it on the deepest function/method on your project.

package main

import "github.com/aldy505/decrr"

func main() {
  err := ExecuteSomething()
  log.Fatal(err)
}

func ExecuteSomething() error {
  return SomethingElse()
}

func SomethingElse() error {
  err := errors.New("a goat just passes by!")
  return decrr.Wrap(err)
}

And yes, it only has one .Wrap(error) function. Nothing else.

License

MIT License

About

Error decorator that returns native error type in Go

Topics

Resources

License

Stars

Watchers

Forks

Sponsor this project

  •  

Packages

No packages published

Languages