Skip to content
alextanhongpinPublic

About

Golang errors

Topics

Resources

Stars

1 star

Watchers

1 watching

Forks

Latest commit

 

History

65 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Errors

The errors package solves some of the pain points when working with errors in golang.

That includes

  • optional stacktrace
  • annotate stacktrace with cause
  • grouping errors with errors Code
  • custom errors with errors Kind
  • mapping errors Code to HTTP/gRPC status code
  • does not conflict with the standard errors package name

Some things that are considered, but is not included when designing this package is

  • localization

Installation

$ go get github.com/alextanhongpin/errors

Usage

There are three subpackage in the errors package, each fulfilling different usecase:

  • causes: create custom errors
  • codes: standard error codes that can be mapped to HTTP/gRPC codes
  • stacktrace: add stacktrace to errors and annotate cause

Each folder contains usage examples.

About

Golang errors

Topics

Resources

Stars

1 star

Watchers

1 watching

Forks

Releases

Packages

Used by

Contributors

Languages