Skip to content
robert-zarembaPublic

About

stacked error wrappers

Resources

Stars

4 stars

Watchers

2 watching

Forks

Repository files navigation

errstack

GoDoc

stacked error wrappers

Package errstack provides a way to augment errors with a functional type and iteratively build new request error.

How to handle errors?

Rule of thumb:

An error should be handled only once. Logging an error is handling an error. So an error should either be logged or propagated.

Motivation

In software we have 3 types of errors:

  • Infrastructure - this errors come from the requests to other services.
  • Domain - this is the type of errors when we detect that our internal application state is wrong.
  • Request - a user request error.

Request errors maps parameters (application inputs) to the cause description (why the value of wrong).

Domain errors usually arise form some model bug or unhandled condition.

Infrastructure errors arise from the system or connection error.

It is very handy to know the place (stack) where the error Infrastructure or Domain error arose - that's why they are threatened especially and are augmented with the stack trace.

Credits

The initial work was done for the AgFlow project.

About

stacked error wrappers

Resources

Stars

4 stars

Watchers

2 watching

Forks

Releases

Packages

Used by

Contributors

Languages

⌂ 换网址