package
0.0.0-20200416044943-d22e7c36ff52
Repository: https://github.com/albertwidi/go-project-example.git
Documentation: pkg.go.dev

# Packages

No description provided by the author

# README

XErrors

XErrors package wrap Go 1.13 errors package

This package has upspin style error.

Creating Error

Creating error in xerrors is as simple as in errors package

xerrors.New("this is an error)

Error With Kind

Error can be ambigous and hard to categorized, kind is a constant that means to categorized error.

For example:

  • Not Found
  • Internal Error
  • OK
  • Bad Request

To create an error with kind:

xerrors.New("this is an error", xerrors.KindOK)

Error With Op/Operation

Sometimes function need to be tagged, especially for tracing. With op we can tag our error to trace our error more easily.

To create an error with op:

xerrors.New(xerrors.Op("doing_something), "this is an error")