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

# 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")

# Packages

No description provided by the author

# Functions

As wrap the error as.
Is wrap the errors is.
New errors.
SetCaller to print the stack-trace of the error.
Unwrap error.
XUnwrap return errors with xerror package type.

# Constants

kind of errors.
kind of errors.
kind of errors.
kind of errors.
kind of errors.

# Structs

Errors of xerrors.

# Type aliases

Fields of errors.
Kind of errors.
Op is the operation when error happens.